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