Disable "Battery dialog" for default apps

If it is default active app(i.e. Phone, SMS), disable battery
optimzation dialog so user can't optimize it.

Fixes: 118910079
Test: RunSettingsLibRoboTests
Change-Id: I7223913c1e6ef68d84adfc2c54d133661a529202
This commit is contained in:
jackqdyulei
2019-03-29 11:37:47 -07:00
parent d94d72a16c
commit 8a61657c6d

View File

@@ -927,6 +927,7 @@ public class ManageApplications extends InstrumentedFragment
private boolean mHasReceivedBridgeCallback;
private FileViewHolderController mExtraViewController;
private SearchFilter mSearchFilter;
private PowerWhitelistBackend mBackend;
// This is to remember and restore the last scroll position when this
// fragment is paused. We need this special handling because app entries are added gradually
@@ -1361,8 +1362,9 @@ public class ManageApplications extends InstrumentedFragment
return true;
}
ApplicationsState.AppEntry entry = mEntries.get(position);
return !PowerWhitelistBackend.getInstance(mContext)
.isSysWhitelisted(entry.info.packageName);
return !mBackend.isSysWhitelisted(entry.info.packageName)
&& !mBackend.isDefaultActiveApp(entry.info.packageName);
}
@Override