Update fuelguage to use uid in AppInfo
The uid is needed to distinguish the same app used by different users(even work profile user). So we need to store the correct uid in AppInfo and use it across the settings app. Bug: 74022362 Test: RunSettingsRoboTests Change-Id: Iaa0ea1ac1fbd3a3a1251e0cd1096d6a8c75c4ed8
This commit is contained in:
@@ -130,19 +130,15 @@ public class RestrictedAppDetails extends DashboardFragment {
|
||||
appInfo.packageName, 0 /* flags */);
|
||||
checkBoxPreference.setChecked(true);
|
||||
checkBoxPreference.setTitle(mPackageManager.getApplicationLabel(applicationInfo));
|
||||
checkBoxPreference.setKey(appInfo.packageName);
|
||||
checkBoxPreference.setIcon(
|
||||
Utils.getBadgedIcon(mIconDrawableFactory, mPackageManager,
|
||||
appInfo.packageName,
|
||||
UserHandle.getUserId(
|
||||
mBatteryUtils.getPackageUid(appInfo.packageName))));
|
||||
UserHandle.getUserId(appInfo.uid)));
|
||||
checkBoxPreference.setOnPreferenceChangeListener((pref, value) -> {
|
||||
// change the toggle
|
||||
final int mode = (Boolean) value ? AppOpsManager.MODE_IGNORED
|
||||
: AppOpsManager.MODE_ALLOWED;
|
||||
final String packageName = pref.getKey();
|
||||
final int uid = mBatteryUtils.getPackageUid(packageName);
|
||||
mBatteryUtils.setForceAppStandby(uid, packageName, mode);
|
||||
mBatteryUtils.setForceAppStandby(appInfo.uid, appInfo.packageName, mode);
|
||||
return true;
|
||||
});
|
||||
mRestrictedAppListGroup.addPreference(checkBoxPreference);
|
||||
|
Reference in New Issue
Block a user