summaryrefslogtreecommitdiffstats
path: root/src/com/android/packageinstaller/wear/PackageInstallerFactory.java
diff options
context:
space:
mode:
authorAnthony Hugh <ahugh@google.com>2016-05-05 13:37:35 -0700
committerAnthony Hugh <ahugh@google.com>2016-05-09 21:50:11 +0000
commit941a7c8f242bdc8847c0b47a7621738ac416944f (patch)
tree59184ac08c05e5b34b8822a3ee6250989f12105e /src/com/android/packageinstaller/wear/PackageInstallerFactory.java
parentc657da434b5802e6cca747f46de1b1fd667d572d (diff)
downloadandroid_packages_apps_PackageInstaller-941a7c8f242bdc8847c0b47a7621738ac416944f.tar.gz
android_packages_apps_PackageInstaller-941a7c8f242bdc8847c0b47a7621738ac416944f.tar.bz2
android_packages_apps_PackageInstaller-941a7c8f242bdc8847c0b47a7621738ac416944f.zip
Update Wearable install logic to use stream API
The default directory for PackageInstaller moved from /data/user/foo to /data/user_de/foo. Not sure on the exact reason why, but it has something to do with the file based encryption changes in N. This was causing the temp APK file that we were passing to PackageManager for installs to be in an invalid location. This resulted in failed installations. This is OK though because we never really wanted to use a temporary file. We were using it due to limitations in the PackageInstaller APIs. Since implementation, new APIs have been added to allow us to pass a stream through instead. This CL updates the install logic to use the stream API instead. Because this code path is being deprecated and replaced, I've opted to do the bare minimum needed to keep this code operational. I've also borrowed installation code from Wearsky/Finsky codebase to make it easier and more reliable. BUG: 28021618 Change-Id: Ia245abf56649e350e99cf48d2b503906d3cd855c
Diffstat (limited to 'src/com/android/packageinstaller/wear/PackageInstallerFactory.java')
-rw-r--r--src/com/android/packageinstaller/wear/PackageInstallerFactory.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/android/packageinstaller/wear/PackageInstallerFactory.java b/src/com/android/packageinstaller/wear/PackageInstallerFactory.java
new file mode 100644
index 00000000..bdc22cf0
--- /dev/null
+++ b/src/com/android/packageinstaller/wear/PackageInstallerFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.packageinstaller.wear;
+
+import android.content.Context;
+
+/**
+ * Factory that creates a Package Installer.
+ */
+public class PackageInstallerFactory {
+ private static PackageInstallerImpl sPackageInstaller;
+
+ /**
+ * Return the PackageInstaller shared object. {@code init} should have already been called.
+ */
+ public synchronized static PackageInstallerImpl getPackageInstaller(Context context) {
+ if (sPackageInstaller == null) {
+ sPackageInstaller = new PackageInstallerImpl(context);
+ }
+ return sPackageInstaller;
+ }
+} \ No newline at end of file