1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.content.pm;
18 
19 import android.app.PendingIntent;
20 import android.content.pm.ArchivedPackageParcel;
21 import android.content.pm.IPackageDeleteObserver2;
22 import android.content.pm.IPackageInstallerCallback;
23 import android.content.pm.IPackageInstallerSession;
24 import android.content.pm.PackageInstaller;
25 import android.content.pm.ParceledListSlice;
26 import android.content.pm.VersionedPackage;
27 import android.content.IntentSender;
28 import android.os.RemoteCallback;
29 import android.os.UserHandle;
30 
31 import android.graphics.Bitmap;
32 
33 /** {@hide} */
34 interface IPackageInstaller {
createSession(in PackageInstaller.SessionParams params, String installerPackageName, String installerAttributionTag, int userId)35     int createSession(in PackageInstaller.SessionParams params, String installerPackageName,
36             String installerAttributionTag, int userId);
37 
updateSessionAppIcon(int sessionId, in Bitmap appIcon)38     void updateSessionAppIcon(int sessionId, in Bitmap appIcon);
updateSessionAppLabel(int sessionId, String appLabel)39     void updateSessionAppLabel(int sessionId, String appLabel);
40 
abandonSession(int sessionId)41     void abandonSession(int sessionId);
42 
openSession(int sessionId)43     IPackageInstallerSession openSession(int sessionId);
44 
getSessionInfo(int sessionId)45     PackageInstaller.SessionInfo getSessionInfo(int sessionId);
46 
getAllSessions(int userId)47     ParceledListSlice getAllSessions(int userId);
getMySessions(String installerPackageName, int userId)48     ParceledListSlice getMySessions(String installerPackageName, int userId);
49 
getStagedSessions()50     ParceledListSlice getStagedSessions();
51 
registerCallback(IPackageInstallerCallback callback, int userId)52     void registerCallback(IPackageInstallerCallback callback, int userId);
unregisterCallback(IPackageInstallerCallback callback)53     void unregisterCallback(IPackageInstallerCallback callback);
54 
55     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
uninstall(in VersionedPackage versionedPackage, String callerPackageName, int flags, in IntentSender statusReceiver, int userId)56     void uninstall(in VersionedPackage versionedPackage, String callerPackageName, int flags,
57             in IntentSender statusReceiver, int userId);
58 
uninstallExistingPackage(in VersionedPackage versionedPackage, String callerPackageName, in IntentSender statusReceiver, int userId)59     void uninstallExistingPackage(in VersionedPackage versionedPackage, String callerPackageName,
60             in IntentSender statusReceiver, int userId);
61 
installExistingPackage(String packageName, int installFlags, int installReason, in IntentSender statusReceiver, int userId, in List<String> whiteListedPermissions)62     void installExistingPackage(String packageName, int installFlags, int installReason,
63             in IntentSender statusReceiver, int userId, in List<String> whiteListedPermissions);
64 
65     @EnforcePermission("INSTALL_PACKAGES")
setPermissionsResult(int sessionId, boolean accepted)66     void setPermissionsResult(int sessionId, boolean accepted);
67 
bypassNextStagedInstallerCheck(boolean value)68     void bypassNextStagedInstallerCheck(boolean value);
69 
bypassNextAllowedApexUpdateCheck(boolean value)70     void bypassNextAllowedApexUpdateCheck(boolean value);
71 
disableVerificationForUid(int uid)72     void disableVerificationForUid(int uid);
73 
setAllowUnlimitedSilentUpdates(String installerPackageName)74     void setAllowUnlimitedSilentUpdates(String installerPackageName);
setSilentUpdatesThrottleTime(long throttleTimeInSeconds)75     void setSilentUpdatesThrottleTime(long throttleTimeInSeconds);
checkInstallConstraints(String installerPackageName, in List<String> packageNames, in PackageInstaller.InstallConstraints constraints, in RemoteCallback callback)76     void checkInstallConstraints(String installerPackageName, in List<String> packageNames,
77             in PackageInstaller.InstallConstraints constraints, in RemoteCallback callback);
waitForInstallConstraints(String installerPackageName, in List<String> packageNames, in PackageInstaller.InstallConstraints constraints, in IntentSender callback, long timeout)78     void waitForInstallConstraints(String installerPackageName, in List<String> packageNames,
79             in PackageInstaller.InstallConstraints constraints, in IntentSender callback,
80             long timeout);
81 
82     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf={android.Manifest.permission.DELETE_PACKAGES,android.Manifest.permission.REQUEST_DELETE_PACKAGES})")
requestArchive(String packageName, String callerPackageName, int flags, in IntentSender statusReceiver, in UserHandle userHandle)83     void requestArchive(String packageName, String callerPackageName, int flags, in IntentSender statusReceiver, in UserHandle userHandle);
84 
85     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES,android.Manifest.permission.REQUEST_INSTALL_PACKAGES})")
requestUnarchive(String packageName, String callerPackageName, in IntentSender statusReceiver, in UserHandle userHandle)86     void requestUnarchive(String packageName, String callerPackageName, in IntentSender statusReceiver, in UserHandle userHandle);
87 
88     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES)")
installPackageArchived(in ArchivedPackageParcel archivedPackageParcel, in PackageInstaller.SessionParams params, in IntentSender statusReceiver, String installerPackageName, in UserHandle userHandle)89     void installPackageArchived(in ArchivedPackageParcel archivedPackageParcel,
90             in PackageInstaller.SessionParams params,
91             in IntentSender statusReceiver,
92             String installerPackageName, in UserHandle userHandle);
93 
94     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES,android.Manifest.permission.REQUEST_INSTALL_PACKAGES})")
reportUnarchivalStatus(int unarchiveId, int status, long requiredStorageBytes, in PendingIntent userActionIntent, in UserHandle userHandle)95     void reportUnarchivalStatus(int unarchiveId, int status, long requiredStorageBytes, in PendingIntent userActionIntent, in UserHandle userHandle);
96 }
97