Add whitelist in ResetAppsHelper
- Add "com.android.systemui" and "com.android.vending" into the whitelist.
- Add "com.android.providers.downloads" and "android" into the whitelist.
- Do not data clear in the whitelist.
Fixes: 147124412
Test: manual test
Change-Id: Ie2f527309f9159babe79636a69ff13fe3ceb64d9
Merged-In: Ie2f527309f9159babe79636a69ff13fe3ceb64d9
(cherry picked from commit b54d2f90f2
)
This commit is contained in:
@@ -424,4 +424,11 @@
|
|||||||
<!-- Package name of dialer supports RTT setting-->
|
<!-- Package name of dialer supports RTT setting-->
|
||||||
<string name="config_rtt_setting_package_name" translatable="false"></string>
|
<string name="config_rtt_setting_package_name" translatable="false"></string>
|
||||||
|
|
||||||
|
<!-- Reset application package name -->
|
||||||
|
<string-array name="config_skip_reset_apps_package_name" translatable="false">
|
||||||
|
<item>android</item>
|
||||||
|
<item>com.android.providers.downloads</item>
|
||||||
|
<item>com.android.systemui</item>
|
||||||
|
<item>com.android.vending</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_skip_reset_apps_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