[go: nahoru, domu]

1f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate/*
2f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * Copyright (C) 2014 The Android Open Source Project
3f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate *
4f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * Licensed under the Apache License, Version 2.0 (the "License");
5f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * you may not use this file except in compliance with the License.
6f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * You may obtain a copy of the License at
7f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate *
8f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate *      http://www.apache.org/licenses/LICENSE-2.0
9f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate *
10f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * Unless required by applicable law or agreed to in writing, software
11f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * distributed under the License is distributed on an "AS IS" BASIS,
12f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * See the License for the specific language governing permissions and
14f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate * limitations under the License.
15f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate */
16f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate
17f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tatepackage android.app;
18f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate
19fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkeyimport android.content.Intent;
20f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tateimport android.content.pm.IPackageInstallObserver2;
21f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tateimport android.os.Bundle;
22f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate
233a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey/** {@hide} */
24f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tatepublic class PackageInstallObserver {
253a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey    private final IPackageInstallObserver2.Stub mBinder = new IPackageInstallObserver2.Stub() {
26f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate        @Override
27fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey        public void onUserActionRequired(Intent intent) {
28fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey            PackageInstallObserver.this.onUserActionRequired(intent);
29fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey        }
30fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey
31fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey        @Override
32fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey        public void onPackageInstalled(String basePackageName, int returnCode,
33fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey                String msg, Bundle extras) {
34fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey            PackageInstallObserver.this.onPackageInstalled(basePackageName, returnCode, msg,
35fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey                    extras);
36f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate        }
37f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate    };
38f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate
393a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey    /** {@hide} */
40bb580670350b76fa2fcc5ee873f99b7970759cbfJeff Sharkey    public IPackageInstallObserver2 getBinder() {
413a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey        return mBinder;
423a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey    }
433a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey
44fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey    public void onUserActionRequired(Intent intent) {
45fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey    }
46fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey
47f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate    /**
483a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * This method will be called to report the result of the package
493a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * installation attempt.
50f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate     *
513a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * @param basePackageName Name of the package whose installation was
523a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            attempted
533a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * @param extras If non-null, this Bundle contains extras providing
543a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            additional information about an install failure. See
553a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            {@link android.content.pm.PackageManager} for documentation
563a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            about which extras apply to various failures; in particular
573a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            the strings named EXTRA_FAILURE_*.
583a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * @param returnCode The numeric success or failure code indicating the
593a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     *            basic outcome
603a44f3f1b446315ef894e01d2ab9b5388c2bd8c4Jeff Sharkey     * @hide
61f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate     */
62fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey    public void onPackageInstalled(String basePackageName, int returnCode, String msg,
63fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4cJeff Sharkey            Bundle extras) {
64bb580670350b76fa2fcc5ee873f99b7970759cbfJeff Sharkey    }
65f1977b4500e82b72ea6aa5c46d97406a20017cafChristopher Tate}
66