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.content.Intent; 20 import android.content.pm.IPackageInstallObserver2; 21 import android.os.Bundle; 22 23 /** {@hide} */ 24 public class PackageInstallObserver { 25 private final IPackageInstallObserver2.Stub mBinder = new IPackageInstallObserver2.Stub() { 26 @Override 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); 36 } 37 }; 38 39 /** {@hide} */ getBinder()40 public IPackageInstallObserver2 getBinder() { 41 return mBinder; 42 } 43 onUserActionRequired(Intent intent)44 public void onUserActionRequired(Intent intent) { 45 } 46 47 /** 48 * This method will be called to report the result of the package 49 * installation attempt. 50 * 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 61 */ onPackageInstalled(String basePackageName, int returnCode, String msg, Bundle extras)62 public void onPackageInstalled(String basePackageName, int returnCode, String msg, 63 Bundle extras) { 64 } 65 } 66