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