OSDN Git Service

DO NOT MERGE. Grant MMS Uri permissions as the calling UID.
[android-x86/frameworks-base.git] / core / java / android / app / ActivityManagerInternal.java
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.NonNull;
20 import android.content.ComponentName;
21 import android.content.IIntentSender;
22 import android.content.Intent;
23 import android.os.IBinder;
24 import android.service.voice.IVoiceInteractionSession;
25
26 import com.android.internal.app.IVoiceInteractor;
27
28 import java.util.List;
29
30 /**
31  * Activity manager local system service interface.
32  *
33  * @hide Only for use within the system server.
34  */
35 public abstract class ActivityManagerInternal {
36
37     /**
38      * Type for {@link #notifyAppTransitionStarting}: The transition was started because we had
39      * the surface saved.
40      */
41     public static final int APP_TRANSITION_SAVED_SURFACE = 0;
42
43     /**
44      * Type for {@link #notifyAppTransitionStarting}: The transition was started because we drew
45      * the starting window.
46      */
47     public static final int APP_TRANSITION_STARTING_WINDOW = 1;
48
49     /**
50      * Type for {@link #notifyAppTransitionStarting}: The transition was started because we all
51      * app windows were drawn
52      */
53     public static final int APP_TRANSITION_WINDOWS_DRAWN = 2;
54
55     /**
56      * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a
57      * timeout.
58      */
59     public static final int APP_TRANSITION_TIMEOUT = 3;
60
61     /**
62      * Grant Uri permissions from one app to another. This method only extends
63      * permission grants if {@code callingUid} has permission to them.
64      */
65     public abstract void grantUriPermissionFromIntent(int callingUid, String targetPkg,
66             Intent intent, int targetUserId);
67
68     /**
69      * Verify that calling app has access to the given provider.
70      */
71     public abstract String checkContentProviderAccess(String authority, int userId);
72
73     // Called by the power manager.
74     public abstract void onWakefulnessChanged(int wakefulness);
75
76     public abstract int startIsolatedProcess(String entryPoint, String[] mainArgs,
77             String processName, String abiOverride, int uid, Runnable crashHandler);
78
79     /**
80      * Acquires a sleep token with the specified tag.
81      *
82      * @param tag A string identifying the purpose of the token (eg. "Dream").
83      */
84     public abstract SleepToken acquireSleepToken(@NonNull String tag);
85
86     /**
87      * Sleep tokens cause the activity manager to put the top activity to sleep.
88      * They are used by components such as dreams that may hide and block interaction
89      * with underlying activities.
90      */
91     public static abstract class SleepToken {
92
93         /**
94          * Releases the sleep token.
95          */
96         public abstract void release();
97     }
98
99     /**
100      * Returns home activity for the specified user.
101      *
102      * @param userId ID of the user or {@link android.os.UserHandle#USER_ALL}
103      */
104     public abstract ComponentName getHomeActivityForUser(int userId);
105
106     /**
107      * Called when a user has been deleted. This can happen during normal device usage
108      * or just at startup, when partially removed users are purged. Any state persisted by the
109      * ActivityManager should be purged now.
110      *
111      * @param userId The user being cleaned up.
112      */
113     public abstract void onUserRemoved(int userId);
114
115     public abstract void onLocalVoiceInteractionStarted(IBinder callingActivity,
116             IVoiceInteractionSession mSession,
117             IVoiceInteractor mInteractor);
118
119     /**
120      * Callback for window manager to let activity manager know that the starting window has been
121      * drawn
122      */
123     public abstract void notifyStartingWindowDrawn();
124
125     /**
126      * Callback for window manager to let activity manager know that we are finally starting the
127      * app transition;
128      *
129      * @param reason The reason why the app transition started. Must be one of the APP_TRANSITION_*
130      *               values.
131      */
132     public abstract void notifyAppTransitionStarting(int reason);
133
134     /**
135      * Callback for window manager to let activity manager know that the app transition was
136      * cancelled.
137      */
138     public abstract void notifyAppTransitionCancelled();
139
140     /**
141      * Callback for window manager to let activity manager know that the app transition is finished.
142      */
143     public abstract void notifyAppTransitionFinished();
144
145     /**
146      * Returns the top activity from each of the currently visible stacks. The first entry will be
147      * the focused activity.
148      */
149     public abstract List<IBinder> getTopVisibleActivities();
150
151     /**
152      * Callback for window manager to let activity manager know that docked stack changes its
153      * minimized state.
154      */
155     public abstract void notifyDockedStackMinimizedChanged(boolean minimized);
156
157     /**
158      * Kill foreground apps from the specified user.
159      */
160     public abstract void killForegroundAppsForUser(int userHandle);
161
162     /**
163      *  Sets how long a {@link PendingIntent} can be temporarily whitelist to by bypass restrictions
164      *  such as Power Save mode.
165      */
166     public abstract void setPendingIntentWhitelistDuration(IIntentSender target, long duration);
167 }