<!-- Manage applications, title for dialog when killing persistent apps-->
<!-- Manage applications, text for Move button when move is in progress -->
<string name="moving">Moving</string>
+
+ <!-- Manage applications, text for move error messages -->
+ <string name="insufficient_storage">There is not enough storage left.</string>
+ <string name="does_not_exist">The application does not exist.</string>
+ <string name="app_forward_locked">The application is forward locked</string>
+ <string name="invalid_location">The specified install location is not valid.</string>
+ <string name="system_package">System updates cannot be installed on external media.</string>
+
<string name="force_stop_dlg_title">Force Stop</string>
<!-- Manage applications, text for dialog when killing persistent apps-->
<string name="force_stop_dlg_text">This application will be restarted right way. Are you sure you want to force stop?</string>
+ <!-- Manage applications, text for dialog when moving an app -->
+ <string name="move_app_failed_dlg_title">Move Application</string>
+ <!-- Manage applications, text for dialog moving an app -->
+ <string name="move_app_failed_dlg_text">Failed to move application. <xliff:g id="reason">%1$s</xliff:g></string>
<!-- Manage applications, application installation location title -->
<string name="app_install_location_title">Preferred install location</string>
<!-- Manage applications. application installation location summary -->
private Button mForceStopButton;
private Button mClearDataButton;
private Button mMoveAppButton;
+ private int mMoveErrorCode;
PackageStats mSizeInfo;
private PackageManager mPm;
private static final int DLG_APP_NOT_FOUND = DLG_BASE + 3;
private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 4;
private static final int DLG_FORCE_STOP = DLG_BASE + 5;
+ private static final int DLG_MOVE_FAILED = DLG_BASE + 6;
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
initMoveButton();
}
+ private CharSequence getMoveErrMsg(int errCode) {
+ switch (errCode) {
+ case PackageManager.MOVE_FAILED_INSUFFICIENT_STORAGE:
+ return getString(R.string.insufficient_storage);
+ case PackageManager.MOVE_FAILED_DOESNT_EXIST:
+ return getString(R.string.does_not_exist);
+ case PackageManager.MOVE_FAILED_FORWARD_LOCKED:
+ return getString(R.string.app_forward_locked);
+ case PackageManager.MOVE_FAILED_INVALID_LOCATION:
+ return getString(R.string.invalid_location);
+ case PackageManager.MOVE_FAILED_SYSTEM_PACKAGE:
+ return getString(R.string.system_package);
+ }
+ return null;
+ }
+
private void initMoveButton() {
String pkgName = mAppInfo.packageName;
boolean dataOnly = false;
mAppInfo = mPm.getApplicationInfo(packageName,
PackageManager.GET_UNINSTALLED_PACKAGES);
initMoveButton();
+ // Refresh size info
+ mPm.getPackageSizeInfo(mAppInfo.packageName, mSizeObserver);
} catch (NameNotFoundException e) {
// TODO error handling
}
} else {
- // TODO Present a dialog indicating failure.
+ initMoveButton();
+ mMoveErrorCode = result;
+ showDialogInner(DLG_MOVE_FAILED);
}
}
-
+
/*
* Private method to initiate clearing user data when the user clicks the clear data
* button for a system package
})
.setNegativeButton(R.string.dlg_cancel, null)
.create();
+ case DLG_MOVE_FAILED:
+ CharSequence msg = getString(R.string.move_app_failed_dlg_text,
+ getMoveErrMsg(mMoveErrorCode));
+ return new AlertDialog.Builder(this)
+ .setTitle(getString(R.string.move_app_failed_dlg_title))
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(msg)
+ .setNeutralButton(R.string.dlg_ok, null)
+ .create();
}
return null;
}