am f7c886b4: Respect android:allowClearUserData=false during restore
Merge commit 'f7c886b4fe27cd9ab4a9991958ff931054556a24' * commit 'f7c886b4fe27cd9ab4a9991958ff931054556a24': Respect android:allowClearUserData=false during restore
This commit is contained in:
committed by
The Android Open Source Project
commit
f9435d7521
@@ -529,6 +529,19 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
|
||||
// clear an application's data, blocking until the operation completes or times out
|
||||
void clearApplicationDataSynchronous(String packageName) {
|
||||
// Don't wipe packages marked allowClearUserData=false
|
||||
try {
|
||||
PackageInfo info = mPackageManager.getPackageInfo(packageName, 0);
|
||||
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_ALLOW_CLEAR_USER_DATA) == 0) {
|
||||
if (DEBUG) Log.i(TAG, "allowClearUserData=false so not wiping "
|
||||
+ packageName);
|
||||
return;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.w(TAG, "Tried to clear data for " + packageName + " but not found");
|
||||
return;
|
||||
}
|
||||
|
||||
ClearDataObserver observer = new ClearDataObserver();
|
||||
|
||||
synchronized(mClearDataLock) {
|
||||
|
||||
Reference in New Issue
Block a user