summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2010-01-25 12:40:34 -0800
committerSuchi Amalapurapu <asuchitra@google.com>2010-01-25 17:54:55 -0800
commit9629a925eded634556b444d6d11985894dfb9f6a (patch)
tree0ddb169e02b23ef417778c0de4a1d5facad72870
parente40d35ee030031d04dc6f8d53af5710ae16b351e (diff)
downloadandroid_packages_apps_PackageInstaller-9629a925eded634556b444d6d11985894dfb9f6a.tar.gz
android_packages_apps_PackageInstaller-9629a925eded634556b444d6d11985894dfb9f6a.tar.bz2
android_packages_apps_PackageInstaller-9629a925eded634556b444d6d11985894dfb9f6a.zip
Remove copying temporary file into installer's private data directory.
The system process can now make a copy for itself.
-rwxr-xr-xsrc/com/android/packageinstaller/InstallAppProgress.java46
-rw-r--r--src/com/android/packageinstaller/PackageInstallerActivity.java2
2 files changed, 1 insertions, 47 deletions
diff --git a/src/com/android/packageinstaller/InstallAppProgress.java b/src/com/android/packageinstaller/InstallAppProgress.java
index 1ecc1f1e..96fe7a7a 100755
--- a/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/src/com/android/packageinstaller/InstallAppProgress.java
@@ -66,8 +66,6 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
final static int FAILED = 0;
private final int INSTALL_COMPLETE = 1;
private Intent mLaunchIntent;
- private File mTmpFile;
- private final String TMP_FILE_NAME="tmpCopy.apk";
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
@@ -157,15 +155,6 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
mLaunchButton = (Button)findViewById(R.id.launch_button);
mOkPanel.setVisibility(View.INVISIBLE);
- // Create temp file before invoking install api
- mTmpFile = createTempPackageFile(mPackageURI.getPath());
- if (mTmpFile == null) {
- Message msg = mHandler.obtainMessage(INSTALL_COMPLETE);
- msg.arg1 = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- mHandler.sendMessage(msg);
- return;
- }
- mPackageURI = Uri.parse("file://" + mTmpFile.getPath());
String installerPackageName = getIntent().getStringExtra(
Intent.EXTRA_INSTALLER_PACKAGE_NAME);
@@ -176,9 +165,6 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
@Override
protected void onDestroy() {
super.onDestroy();
- if (mTmpFile != null && mTmpFile.exists()) {
- mTmpFile.delete();
- }
}
public void onClick(View v) {
@@ -192,36 +178,4 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
finish();
}
}
-
- private File createTempPackageFile(String filePath) {
- File tmpPackageFile = getFileStreamPath(TMP_FILE_NAME);
- if (tmpPackageFile == null) {
- Log.w(TAG, "Failed to create temp file");
- return null;
- }
- if (tmpPackageFile.exists()) {
- tmpPackageFile.delete();
- }
- // Open file to make it world readable
- FileOutputStream fos;
- try {
- fos = openFileOutput(TMP_FILE_NAME, MODE_WORLD_READABLE);
- } catch (FileNotFoundException e1) {
- Log.e(TAG, "Error opening file " + TMP_FILE_NAME);
- return null;
- }
- try {
- fos.close();
- } catch (IOException e) {
- Log.e(TAG, "Error opening file " + TMP_FILE_NAME);
- return null;
- }
-
- File srcPackageFile = new File(filePath);
- if (!FileUtils.copyFile(srcPackageFile, tmpPackageFile)) {
- Log.w(TAG, "Failed to make copy of file: " + srcPackageFile);
- return null;
- }
- return tmpPackageFile;
- }
}
diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java
index b1651943..a945a548 100644
--- a/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -315,7 +315,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
String apkPath = mPackageURI.getPath();
File apkFile = new File(apkPath);
//TODO? DEVISE BETTER HEAURISTIC
- size = 4*apkFile.length();
+ size = 1*apkFile.length();
checkOutOfSpace(size);
}