Block moving when already in progress.
Use frozen state as a proxy for knowing if a package is currently being moved, and block any new move requests until the current move is finished. Bug: 22069486 Change-Id: I50a70353132c1035b969982f0b7779f5dcb2251d
This commit is contained in:
@@ -18,15 +18,18 @@ package com.android.settings.applications;
|
|||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AppGlobals;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.IPackageDataObserver;
|
import android.content.pm.IPackageDataObserver;
|
||||||
|
import android.content.pm.IPackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.os.storage.VolumeInfo;
|
import android.os.storage.VolumeInfo;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
@@ -183,11 +186,21 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
} else {
|
} else {
|
||||||
showDialogInner(DLG_CLEAR_DATA, 0);
|
showDialogInner(DLG_CLEAR_DATA, 0);
|
||||||
}
|
}
|
||||||
} else if (v == mChangeStorageButton && mDialogBuilder != null) {
|
} else if (v == mChangeStorageButton && mDialogBuilder != null && !isMoveInProgress()) {
|
||||||
mDialogBuilder.show();
|
mDialogBuilder.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isMoveInProgress() {
|
||||||
|
final IPackageManager pm = AppGlobals.getPackageManager();
|
||||||
|
try {
|
||||||
|
// TODO: define a cleaner API for this
|
||||||
|
return pm.isPackageFrozen(mPackageName);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
Reference in New Issue
Block a user