Replace the isWorkProfile method from the SettingsLib
Replace the isWorkProfile() in the Settings with the common method defined in the SettingsLib to avoid duplicate code Bug: 306329984 Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge" Change-Id: Ic9b18e6b80c23f9d4fc200080224daa27cbf4a4d
This commit is contained in:
@@ -159,12 +159,6 @@ public final class DatabaseUtils {
|
||||
|
||||
private DatabaseUtils() {}
|
||||
|
||||
/** Returns true if current user is a work profile user. */
|
||||
public static boolean isWorkProfile(Context context) {
|
||||
final UserManager userManager = context.getSystemService(UserManager.class);
|
||||
return userManager.isManagedProfile();
|
||||
}
|
||||
|
||||
/** Returns the latest timestamp current user data in app usage event table. */
|
||||
public static long getAppUsageStartTimestampOfUser(
|
||||
Context context, final long userId, final long earliestTimestamp) {
|
||||
@@ -502,7 +496,7 @@ public final class DatabaseUtils {
|
||||
|
||||
/** Returns the context with profile parent identity when current user is work profile. */
|
||||
public static Context getParentContext(Context context) {
|
||||
if (isWorkProfile(context)) {
|
||||
if (com.android.settingslib.fuelgauge.BatteryUtils.isWorkProfile(context)) {
|
||||
try {
|
||||
return context.createPackageContextAsUser(
|
||||
/* packageName= */ context.getPackageName(),
|
||||
|
Reference in New Issue
Block a user