Loading src/com/android/packageinstaller/InstallAppProgress.java +23 −6 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.graphics.drawable.LevelListDrawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -94,7 +93,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener setResult(msg.arg1 == PackageInstaller.STATUS_SUCCESS ? Activity.RESULT_OK : Activity.RESULT_FIRST_USER, result); finish(); clearCachedApkIfNeededAndFinish(); return; } // Update the status text Loading Loading @@ -206,6 +205,11 @@ public class InstallAppProgress extends Activity implements View.OnClickListener initView(); } @Override public void onBackPressed() { clearCachedApkIfNeededAndFinish(); } @SuppressWarnings("deprecation") @Override public Dialog onCreateDialog(int id, Bundle bundle) { Loading @@ -220,13 +224,13 @@ public class InstallAppProgress extends Activity implements View.OnClickListener //launch manage applications Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE"); startActivity(intent); finish(); clearCachedApkIfNeededAndFinish(); } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.i(TAG, "Canceling installation"); finish(); clearCachedApkIfNeededAndFinish(); } }) .setOnCancelListener(this) Loading Loading @@ -370,14 +374,27 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if (mAppInfo.packageName != null) { Log.i(TAG, "Finished installing "+mAppInfo.packageName); } finish(); clearCachedApkIfNeededAndFinish(); } else if(v == mLaunchButton) { startActivity(mLaunchIntent); finish(); clearCachedApkIfNeededAndFinish(); } } public void onCancel(DialogInterface dialog) { clearCachedApkIfNeededAndFinish(); } private void clearCachedApkIfNeededAndFinish() { // If we are installing from a content:// the apk is copied in the cache // dir and passed in here. As we aren't started for a result because our // caller needs to be able to forward the result, here we make sure the // staging file in the cache dir is removed. if ("file".equals(mPackageURI.getScheme()) && mPackageURI.getPath() != null && mPackageURI.getPath().startsWith(getCacheDir().toString())) { File file = new File(mPackageURI.getPath()); file.delete(); } finish(); } } src/com/android/packageinstaller/PackageInstallerActivity.java +2 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen private static final String TAG = "PackageInstaller"; private static final int REQUEST_ENABLE_UNKNOWN_SOURCES = 1; private static final int REQUEST_INSTALL_PACKAGE = 2; private static final String SCHEME_FILE = "file"; private static final String SCHEME_CONTENT = "content"; Loading Loading @@ -324,7 +323,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if (request == REQUEST_ENABLE_UNKNOWN_SOURCES && result == RESULT_OK) { initiateInstall(); } clearCachedApkIfNeededAndFinish(); } private boolean isInstallRequestFromUnknownSource(Intent intent) { Loading Loading @@ -684,7 +682,8 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); } if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); startActivityForResult(newIntent, REQUEST_INSTALL_PACKAGE); startActivity(newIntent); finish(); } private void clearCachedApkIfNeededAndFinish() { Loading Loading
src/com/android/packageinstaller/InstallAppProgress.java +23 −6 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.graphics.drawable.LevelListDrawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -94,7 +93,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener setResult(msg.arg1 == PackageInstaller.STATUS_SUCCESS ? Activity.RESULT_OK : Activity.RESULT_FIRST_USER, result); finish(); clearCachedApkIfNeededAndFinish(); return; } // Update the status text Loading Loading @@ -206,6 +205,11 @@ public class InstallAppProgress extends Activity implements View.OnClickListener initView(); } @Override public void onBackPressed() { clearCachedApkIfNeededAndFinish(); } @SuppressWarnings("deprecation") @Override public Dialog onCreateDialog(int id, Bundle bundle) { Loading @@ -220,13 +224,13 @@ public class InstallAppProgress extends Activity implements View.OnClickListener //launch manage applications Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE"); startActivity(intent); finish(); clearCachedApkIfNeededAndFinish(); } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.i(TAG, "Canceling installation"); finish(); clearCachedApkIfNeededAndFinish(); } }) .setOnCancelListener(this) Loading Loading @@ -370,14 +374,27 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if (mAppInfo.packageName != null) { Log.i(TAG, "Finished installing "+mAppInfo.packageName); } finish(); clearCachedApkIfNeededAndFinish(); } else if(v == mLaunchButton) { startActivity(mLaunchIntent); finish(); clearCachedApkIfNeededAndFinish(); } } public void onCancel(DialogInterface dialog) { clearCachedApkIfNeededAndFinish(); } private void clearCachedApkIfNeededAndFinish() { // If we are installing from a content:// the apk is copied in the cache // dir and passed in here. As we aren't started for a result because our // caller needs to be able to forward the result, here we make sure the // staging file in the cache dir is removed. if ("file".equals(mPackageURI.getScheme()) && mPackageURI.getPath() != null && mPackageURI.getPath().startsWith(getCacheDir().toString())) { File file = new File(mPackageURI.getPath()); file.delete(); } finish(); } }
src/com/android/packageinstaller/PackageInstallerActivity.java +2 −3 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen private static final String TAG = "PackageInstaller"; private static final int REQUEST_ENABLE_UNKNOWN_SOURCES = 1; private static final int REQUEST_INSTALL_PACKAGE = 2; private static final String SCHEME_FILE = "file"; private static final String SCHEME_CONTENT = "content"; Loading Loading @@ -324,7 +323,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if (request == REQUEST_ENABLE_UNKNOWN_SOURCES && result == RESULT_OK) { initiateInstall(); } clearCachedApkIfNeededAndFinish(); } private boolean isInstallRequestFromUnknownSource(Intent intent) { Loading Loading @@ -684,7 +682,8 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); } if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); startActivityForResult(newIntent, REQUEST_INSTALL_PACKAGE); startActivity(newIntent); finish(); } private void clearCachedApkIfNeededAndFinish() { Loading