• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 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.ComponentName;
20 import android.content.Intent;
21 import android.content.IIntentReceiver;
22 import android.content.pm.ActivityInfo;
23 import android.content.pm.ApplicationInfo;
24 import android.content.pm.ProviderInfo;
25 import android.content.pm.ServiceInfo;
26 import android.content.res.CompatibilityInfo;
27 import android.content.res.Configuration;
28 import android.net.Uri;
29 import android.os.Bundle;
30 import android.os.Debug;
31 import android.os.ParcelFileDescriptor;
32 import android.os.PersistableBundle;
33 import android.os.RemoteException;
34 import android.os.IBinder;
35 import android.os.IInterface;
36 import com.android.internal.app.IVoiceInteractor;
37 import com.android.internal.content.ReferrerIntent;
38 
39 import java.io.FileDescriptor;
40 import java.util.List;
41 import java.util.Map;
42 
43 /**
44  * System private API for communicating with the application.  This is given to
45  * the activity manager by an application  when it starts up, for the activity
46  * manager to tell the application about things it needs to do.
47  *
48  * {@hide}
49  */
50 public interface IApplicationThread extends IInterface {
schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving, int configChanges, boolean dontReport)51     void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving,
52             int configChanges, boolean dontReport) throws RemoteException;
scheduleStopActivity(IBinder token, boolean showWindow, int configChanges)53     void scheduleStopActivity(IBinder token, boolean showWindow,
54             int configChanges) throws RemoteException;
scheduleWindowVisibility(IBinder token, boolean showWindow)55     void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException;
scheduleSleeping(IBinder token, boolean sleeping)56     void scheduleSleeping(IBinder token, boolean sleeping) throws RemoteException;
scheduleResumeActivity(IBinder token, int procState, boolean isForward, Bundle resumeArgs)57     void scheduleResumeActivity(IBinder token, int procState, boolean isForward, Bundle resumeArgs)
58             throws RemoteException;
scheduleSendResult(IBinder token, List<ResultInfo> results)59     void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException;
scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, Configuration overrideConfig, CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor, int procState, Bundle state, PersistableBundle persistentState, List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents, boolean notResumed, boolean isForward, ProfilerInfo profilerInfo)60     void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
61             ActivityInfo info, Configuration curConfig, Configuration overrideConfig,
62             CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor,
63             int procState, Bundle state, PersistableBundle persistentState,
64             List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
65             boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) throws RemoteException;
scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents, int configChanges, boolean notResumed, Configuration config, Configuration overrideConfig, boolean preserveWindow)66     void scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults,
67             List<ReferrerIntent> pendingNewIntents, int configChanges, boolean notResumed,
68             Configuration config, Configuration overrideConfig, boolean preserveWindow)
69             throws RemoteException;
scheduleNewIntent(List<ReferrerIntent> intent, IBinder token)70     void scheduleNewIntent(List<ReferrerIntent> intent, IBinder token) throws RemoteException;
scheduleDestroyActivity(IBinder token, boolean finished, int configChanges)71     void scheduleDestroyActivity(IBinder token, boolean finished,
72             int configChanges) throws RemoteException;
scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser, int processState)73     void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo,
74             int resultCode, String data, Bundle extras, boolean sync,
75             int sendingUser, int processState) throws RemoteException;
76     static final int BACKUP_MODE_INCREMENTAL = 0;
77     static final int BACKUP_MODE_FULL = 1;
78     static final int BACKUP_MODE_RESTORE = 2;
79     static final int BACKUP_MODE_RESTORE_FULL = 3;
scheduleCreateBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo, int backupMode)80     void scheduleCreateBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo,
81             int backupMode) throws RemoteException;
scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo)82     void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo)
83             throws RemoteException;
scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState)84     void scheduleCreateService(IBinder token, ServiceInfo info,
85             CompatibilityInfo compatInfo, int processState) throws RemoteException;
scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState)86     void scheduleBindService(IBinder token,
87             Intent intent, boolean rebind, int processState) throws RemoteException;
scheduleUnbindService(IBinder token, Intent intent)88     void scheduleUnbindService(IBinder token,
89             Intent intent) throws RemoteException;
scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, int flags, Intent args)90     void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
91             int flags, Intent args) throws RemoteException;
scheduleStopService(IBinder token)92     void scheduleStopService(IBinder token) throws RemoteException;
93     static final int DEBUG_OFF = 0;
94     static final int DEBUG_ON = 1;
95     static final int DEBUG_WAIT = 2;
bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo, Bundle testArguments, IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection, int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean restrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings)96     void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers,
97             ComponentName testName, ProfilerInfo profilerInfo, Bundle testArguments,
98             IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection,
99             int debugMode, boolean enableBinderTracking, boolean trackAllocation,
100             boolean restrictedBackupMode, boolean persistent, Configuration config,
101             CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings)
102             throws RemoteException;
scheduleExit()103     void scheduleExit() throws RemoteException;
scheduleSuicide()104     void scheduleSuicide() throws RemoteException;
scheduleConfigurationChanged(Configuration config)105     void scheduleConfigurationChanged(Configuration config) throws RemoteException;
updateTimeZone()106     void updateTimeZone() throws RemoteException;
clearDnsCache()107     void clearDnsCache() throws RemoteException;
setHttpProxy(String proxy, String port, String exclList, Uri pacFileUrl)108     void setHttpProxy(String proxy, String port, String exclList,
109             Uri pacFileUrl) throws RemoteException;
processInBackground()110     void processInBackground() throws RemoteException;
dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)111     void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)
112             throws RemoteException;
dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args)113     void dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args)
114             throws RemoteException;
scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser, int processState)115     void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
116             int resultCode, String data, Bundle extras, boolean ordered,
117             boolean sticky, int sendingUser, int processState) throws RemoteException;
scheduleLowMemory()118     void scheduleLowMemory() throws RemoteException;
scheduleActivityConfigurationChanged(IBinder token, Configuration overrideConfig, boolean reportToActivity)119     void scheduleActivityConfigurationChanged(IBinder token, Configuration overrideConfig,
120             boolean reportToActivity) throws RemoteException;
profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)121     void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)
122             throws RemoteException;
dumpHeap(boolean managed, String path, ParcelFileDescriptor fd)123     void dumpHeap(boolean managed, String path, ParcelFileDescriptor fd)
124             throws RemoteException;
setSchedulingGroup(int group)125     void setSchedulingGroup(int group) throws RemoteException;
126     // the package has been removed, clean up internal references
127     static final int PACKAGE_REMOVED = 0;
128     static final int EXTERNAL_STORAGE_UNAVAILABLE = 1;
129     // the package is being modified in-place, don't kill it and retain references to it
130     static final int PACKAGE_REMOVED_DONT_KILL = 2;
131     // a previously removed package was replaced with a new version [eg. upgrade, split added, ...]
132     static final int PACKAGE_REPLACED = 3;
dispatchPackageBroadcast(int cmd, String[] packages)133     void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException;
scheduleCrash(String msg)134     void scheduleCrash(String msg) throws RemoteException;
dumpActivity(FileDescriptor fd, IBinder servicetoken, String prefix, String[] args)135     void dumpActivity(FileDescriptor fd, IBinder servicetoken, String prefix, String[] args)
136             throws RemoteException;
setCoreSettings(Bundle coreSettings)137     void setCoreSettings(Bundle coreSettings) throws RemoteException;
updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)138     void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) throws RemoteException;
scheduleTrimMemory(int level)139     void scheduleTrimMemory(int level) throws RemoteException;
dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, String[] args)140     void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo,
141             boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable,
142             String[] args) throws RemoteException;
dumpGfxInfo(FileDescriptor fd, String[] args)143     void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException;
dumpDbInfo(FileDescriptor fd, String[] args)144     void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException;
unstableProviderDied(IBinder provider)145     void unstableProviderDied(IBinder provider) throws RemoteException;
requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType, int sessionId)146     void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType,
147             int sessionId) throws RemoteException;
scheduleTranslucentConversionComplete(IBinder token, boolean timeout)148     void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
149             throws RemoteException;
scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)150     void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
151             throws RemoteException;
setProcessState(int state)152     void setProcessState(int state) throws RemoteException;
scheduleInstallProvider(ProviderInfo provider)153     void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
updateTimePrefs(boolean is24Hour)154     void updateTimePrefs(boolean is24Hour) throws RemoteException;
scheduleCancelVisibleBehind(IBinder token)155     void scheduleCancelVisibleBehind(IBinder token) throws RemoteException;
scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled)156     void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled) throws RemoteException;
scheduleEnterAnimationComplete(IBinder token)157     void scheduleEnterAnimationComplete(IBinder token) throws RemoteException;
notifyCleartextNetwork(byte[] firstPacket)158     void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException;
startBinderTracking()159     void startBinderTracking() throws RemoteException;
stopBinderTrackingAndDump(FileDescriptor fd)160     void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException;
scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode)161     void scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode) throws RemoteException;
schedulePictureInPictureModeChanged(IBinder token, boolean isInPictureInPictureMode)162     void schedulePictureInPictureModeChanged(IBinder token, boolean isInPictureInPictureMode) throws RemoteException;
scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor)163     void scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor) throws RemoteException;
164 
165     String descriptor = "android.app.IApplicationThread";
166 
167     int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
168     int SCHEDULE_STOP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2;
169     int SCHEDULE_WINDOW_VISIBILITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3;
170     int SCHEDULE_RESUME_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4;
171     int SCHEDULE_SEND_RESULT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5;
172     int SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+6;
173     int SCHEDULE_NEW_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+7;
174     int SCHEDULE_FINISH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+8;
175     int SCHEDULE_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+9;
176     int SCHEDULE_CREATE_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+10;
177     int SCHEDULE_STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+11;
178     int BIND_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+12;
179     int SCHEDULE_EXIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+13;
180 
181     int SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+15;
182     int SCHEDULE_SERVICE_ARGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+16;
183     int UPDATE_TIME_ZONE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+17;
184     int PROCESS_IN_BACKGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+18;
185     int SCHEDULE_BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+19;
186     int SCHEDULE_UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+20;
187     int DUMP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+21;
188     int SCHEDULE_REGISTERED_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+22;
189     int SCHEDULE_LOW_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+23;
190     int SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+24;
191     int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25;
192     int SCHEDULE_SLEEPING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26;
193     int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27;
194     int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28;
195     int SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29;
196     int SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30;
197     int SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31;
198     int SCHEDULE_SUICIDE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32;
199     int DISPATCH_PACKAGE_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33;
200     int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34;
201     int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35;
202     int DUMP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36;
203     int CLEAR_DNS_CACHE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37;
204     int SET_HTTP_PROXY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38;
205     int SET_CORE_SETTINGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39;
206     int UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40;
207     int SCHEDULE_TRIM_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41;
208     int DUMP_MEM_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+42;
209     int DUMP_GFX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+43;
210     int DUMP_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+44;
211     int DUMP_DB_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+45;
212     int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46;
213     int REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47;
214     int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
215     int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
216     int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
217     int UPDATE_TIME_PREFS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51;
218     int CANCEL_VISIBLE_BEHIND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+52;
219     int BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+53;
220     int ENTER_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+54;
221     int NOTIFY_CLEARTEXT_NETWORK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+55;
222     int START_BINDER_TRACKING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+56;
223     int STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+57;
224     int SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+58;
225     int SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+59;
226     int SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+60;
227 }
228