Merge "Add whitelist in ResetAppsHelper"
This commit is contained in:
committed by
Android (Google) Code Review
commit
1f18ca5021
@@ -417,4 +417,9 @@
|
|||||||
|
|
||||||
<!-- "Show work policy info" intent action. TODO(b/134391103): Replace with final SystemAPI intent when it's available. -->
|
<!-- "Show work policy info" intent action. TODO(b/134391103): Replace with final SystemAPI intent when it's available. -->
|
||||||
<string name="config_work_policy_info_intent_action" translatable="false"/>
|
<string name="config_work_policy_info_intent_action" translatable="false"/>
|
||||||
|
|
||||||
|
<!-- Reset application package name -->
|
||||||
|
<string-array name="config_reset_app_package_name" translatable="false">
|
||||||
|
<item>com.android.systemui</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -37,6 +37,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
||||||
@@ -109,10 +110,17 @@ public class ResetAppsHelper implements DialogInterface.OnClickListener,
|
|||||||
AsyncTask.execute(new Runnable() {
|
AsyncTask.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<ApplicationInfo> apps = mPm.getInstalledApplications(
|
final List<ApplicationInfo> apps = mPm.getInstalledApplications(
|
||||||
PackageManager.GET_DISABLED_COMPONENTS);
|
PackageManager.GET_DISABLED_COMPONENTS);
|
||||||
|
final List<String> whiteList = Arrays.asList(
|
||||||
|
mContext.getResources().getStringArray(
|
||||||
|
R.array.config_reset_app_package_name));
|
||||||
|
|
||||||
for (int i = 0; i < apps.size(); i++) {
|
for (int i = 0; i < apps.size(); i++) {
|
||||||
ApplicationInfo app = apps.get(i);
|
ApplicationInfo app = apps.get(i);
|
||||||
|
if (whiteList.contains(app.packageName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
mNm.clearData(app.packageName, app.uid, false);
|
mNm.clearData(app.packageName, app.uid, false);
|
||||||
} catch (android.os.RemoteException ex) {
|
} catch (android.os.RemoteException ex) {
|
||||||
|
Reference in New Issue
Block a user