Init PowerWhitelistbackend to stop crash
Also update text to "unavailable" to reflect its current status. Fixes: 129955147 Test: Manual Change-Id: Ib80d68d6d2b6bc4ced4a72483859e675b7e7e61c
This commit is contained in:
@@ -952,6 +952,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mContext = manageApplications.getActivity();
|
||||
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
|
||||
mAppFilter = appFilter;
|
||||
mBackend = PowerWhitelistBackend.getInstance(mContext);
|
||||
if (mManageApplications.mListType == LIST_TYPE_NOTIFICATION) {
|
||||
mExtraInfoBridge = new AppStateNotificationBridge(mContext, mState, this,
|
||||
manageApplications.mUsageStatsManager,
|
||||
|
||||
@@ -173,10 +173,18 @@ public class HighPowerDetail extends InstrumentedDialogFragment implements OnCli
|
||||
}
|
||||
|
||||
public static CharSequence getSummary(Context context, String pkg) {
|
||||
PowerWhitelistBackend powerWhitelist = PowerWhitelistBackend.getInstance(context);
|
||||
return context.getString(powerWhitelist.isSysWhitelisted(pkg) ? R.string.high_power_system
|
||||
: powerWhitelist.isWhitelisted(pkg) ? R.string.high_power_on
|
||||
: R.string.high_power_off);
|
||||
return getSummary(context, PowerWhitelistBackend.getInstance(context), pkg);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static CharSequence getSummary(Context context, PowerWhitelistBackend powerWhitelist,
|
||||
String pkg) {
|
||||
return context.getString(
|
||||
powerWhitelist.isSysWhitelisted(pkg) || powerWhitelist.isDefaultActiveApp(pkg)
|
||||
? R.string.high_power_system
|
||||
: powerWhitelist.isWhitelisted(pkg)
|
||||
? R.string.high_power_on
|
||||
: R.string.high_power_off);
|
||||
}
|
||||
|
||||
public static void show(Fragment caller, int uid, String packageName, int requestCode) {
|
||||
|
||||
Reference in New Issue
Block a user