| 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.app; |
| 18 | |
| 19 | import android.compat.annotation.UnsupportedAppUsage; |
| 20 | import android.content.Intent; |
| 21 | import android.content.pm.IPackageInstallObserver2; |
| 22 | import android.os.Bundle; |
| 23 | |
| 24 | /** {@hide} */ |
| 25 | public class PackageInstallObserver { |
| 26 | |
| 27 | @UnsupportedAppUsage |
| 28 | public PackageInstallObserver() { |
| 29 | } |
| 30 | |
| 31 | private final IPackageInstallObserver2.Stub mBinder = new IPackageInstallObserver2.Stub() { |
| 32 | @Override |
| 33 | public void onUserActionRequired(Intent intent) { |
| 34 | PackageInstallObserver.this.onUserActionRequired(intent); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void onPackageInstalled(String basePackageName, int returnCode, |
| 39 | String msg, Bundle extras) { |
| 40 | PackageInstallObserver.this.onPackageInstalled(basePackageName, returnCode, msg, |
| 41 | extras); |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | /** {@hide} */ |
| 46 | public IPackageInstallObserver2 getBinder() { |
| 47 | return mBinder; |
| 48 | } |
| 49 | |
| 50 | public void onUserActionRequired(Intent intent) { |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * This method will be called to report the result of the package |
| 55 | * installation attempt. |
| 56 | * |
| 57 | * @param basePackageName Name of the package whose installation was |
| 58 | * attempted |
| 59 | * @param extras If non-null, this Bundle contains extras providing |
| 60 | * additional information about an install failure. See |
| 61 | * {@link android.content.pm.PackageManager} for documentation |
| 62 | * about which extras apply to various failures; in particular |
| 63 | * the strings named EXTRA_FAILURE_*. |
| 64 | * @param returnCode The numeric success or failure code indicating the |
| 65 | * basic outcome |
| 66 | * @hide |
| 67 | */ |
| 68 | @UnsupportedAppUsage |
| 69 | public void onPackageInstalled(String basePackageName, int returnCode, String msg, |
| 70 | Bundle extras) { |
| 71 | } |
| 72 | } |