summaryrefslogtreecommitdiffstats
path: root/src/com/android/packageinstaller/wear/InstallerConstants.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/InstallerConstants.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/InstallerConstants.java')
-rw-r--r--src/com/android/packageinstaller/wear/InstallerConstants.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/com/android/packageinstaller/wear/InstallerConstants.java b/src/com/android/packageinstaller/wear/InstallerConstants.java
new file mode 100644
index 00000000..3daf3d83
--- /dev/null
+++ b/src/com/android/packageinstaller/wear/InstallerConstants.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+/**
+ * Constants for Installation / Uninstallation requests.
+ * Using the same values as Finsky/Wearsky code for consistency in user analytics of failures
+ */
+public class InstallerConstants {
+ /** Request succeeded */
+ public static final int STATUS_SUCCESS = 0;
+
+ /**
+ * The new PackageInstaller also returns a small set of less granular error codes, which
+ * we'll remap to the range -500 and below to keep away from existing installer codes
+ * (which run from -1 to -110).
+ */
+ public final static int ERROR_PACKAGEINSTALLER_BASE = -500;
+
+ public static final int ERROR_COULD_NOT_GET_FD = -603;
+ /** This node is not targeted by this request. */
+
+ /** The install did not complete because could not create PackageInstaller session */
+ public final static int ERROR_INSTALL_CREATE_SESSION = -612;
+ /** The install did not complete because could not open PackageInstaller session */
+ public final static int ERROR_INSTALL_OPEN_SESSION = -613;
+ /** The install did not complete because could not open PackageInstaller output stream */
+ public final static int ERROR_INSTALL_OPEN_STREAM = -614;
+ /** The install did not complete because of an exception while streaming bytes */
+ public final static int ERROR_INSTALL_COPY_STREAM_EXCEPTION = -615;
+ /** The install did not complete because of an unexpected exception from PackageInstaller */
+ public final static int ERROR_INSTALL_SESSION_EXCEPTION = -616;
+ /** The install did not complete because of an unexpected userActionRequired callback */
+ public final static int ERROR_INSTALL_USER_ACTION_REQUIRED = -617;
+ /** The install did not complete because of an unexpected broadcast (missing fields) */
+ public final static int ERROR_INSTALL_MALFORMED_BROADCAST = -618;
+ /** The install did not complete because of an error while copying from downloaded file */
+ public final static int ERROR_INSTALL_APK_COPY_FAILURE = -619;
+ /** The install did not complete because of an error while copying to the PackageInstaller
+ * output stream */
+ public final static int ERROR_INSTALL_COPY_STREAM = -620;
+ /** The install did not complete because of an error while closing the PackageInstaller
+ * output stream */
+ public final static int ERROR_INSTALL_CLOSE_STREAM = -621;
+} \ No newline at end of file