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.os.Bundle; 29 import android.os.Debug; 30 import android.os.ParcelFileDescriptor; 31 import android.os.RemoteException; 32 import android.os.IBinder; 33 import android.os.IInterface; 34 35 import java.io.FileDescriptor; 36 import java.util.List; 37 import java.util.Map; 38 39 /** 40 * System private API for communicating with the application. This is given to 41 * the activity manager by an application when it starts up, for the activity 42 * manager to tell the application about things it needs to do. 43 * 44 * {@hide} 45 */ 46 public interface IApplicationThread extends IInterface { schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving, int configChanges)47 void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving, 48 int configChanges) throws RemoteException; scheduleStopActivity(IBinder token, boolean showWindow, int configChanges)49 void scheduleStopActivity(IBinder token, boolean showWindow, 50 int configChanges) throws RemoteException; scheduleWindowVisibility(IBinder token, boolean showWindow)51 void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException; scheduleSleeping(IBinder token, boolean sleeping)52 void scheduleSleeping(IBinder token, boolean sleeping) throws RemoteException; scheduleResumeActivity(IBinder token, int procState, boolean isForward)53 void scheduleResumeActivity(IBinder token, int procState, boolean isForward) 54 throws RemoteException; scheduleSendResult(IBinder token, List<ResultInfo> results)55 void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException; scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)56 void scheduleLaunchActivity(Intent intent, IBinder token, int ident, 57 ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, 58 int procState, Bundle state, List<ResultInfo> pendingResults, 59 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, 60 String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) 61 throws RemoteException; scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, int configChanges, boolean notResumed, Configuration config)62 void scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults, 63 List<Intent> pendingNewIntents, int configChanges, 64 boolean notResumed, Configuration config) throws RemoteException; scheduleNewIntent(List<Intent> intent, IBinder token)65 void scheduleNewIntent(List<Intent> intent, IBinder token) throws RemoteException; scheduleDestroyActivity(IBinder token, boolean finished, int configChanges)66 void scheduleDestroyActivity(IBinder token, boolean finished, 67 int configChanges) throws RemoteException; scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser, int processState)68 void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, 69 int resultCode, String data, Bundle extras, boolean sync, 70 int sendingUser, int processState) throws RemoteException; 71 static final int BACKUP_MODE_INCREMENTAL = 0; 72 static final int BACKUP_MODE_FULL = 1; 73 static final int BACKUP_MODE_RESTORE = 2; 74 static final int BACKUP_MODE_RESTORE_FULL = 3; scheduleCreateBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo, int backupMode)75 void scheduleCreateBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo, 76 int backupMode) throws RemoteException; scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo)77 void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo) 78 throws RemoteException; scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState)79 void scheduleCreateService(IBinder token, ServiceInfo info, 80 CompatibilityInfo compatInfo, int processState) throws RemoteException; scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState)81 void scheduleBindService(IBinder token, 82 Intent intent, boolean rebind, int processState) throws RemoteException; scheduleUnbindService(IBinder token, Intent intent)83 void scheduleUnbindService(IBinder token, 84 Intent intent) throws RemoteException; scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, int flags, Intent args)85 void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, 86 int flags, Intent args) throws RemoteException; scheduleStopService(IBinder token)87 void scheduleStopService(IBinder token) throws RemoteException; 88 static final int DEBUG_OFF = 0; 89 static final int DEBUG_ON = 1; 90 static final int DEBUG_WAIT = 2; bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArguments, IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection, int debugMode, boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings)91 void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, 92 ComponentName testName, String profileName, ParcelFileDescriptor profileFd, 93 boolean autoStopProfiler, Bundle testArguments, IInstrumentationWatcher testWatcher, 94 IUiAutomationConnection uiAutomationConnection, int debugMode, 95 boolean openGlTrace, boolean restrictedBackupMode, boolean persistent, 96 Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, 97 Bundle coreSettings) throws RemoteException; scheduleExit()98 void scheduleExit() throws RemoteException; scheduleSuicide()99 void scheduleSuicide() throws RemoteException; requestThumbnail(IBinder token)100 void requestThumbnail(IBinder token) throws RemoteException; scheduleConfigurationChanged(Configuration config)101 void scheduleConfigurationChanged(Configuration config) throws RemoteException; updateTimeZone()102 void updateTimeZone() throws RemoteException; clearDnsCache()103 void clearDnsCache() throws RemoteException; setHttpProxy(String proxy, String port, String exclList, String pacFileUrl)104 void setHttpProxy(String proxy, String port, String exclList, 105 String pacFileUrl) throws RemoteException; processInBackground()106 void processInBackground() throws RemoteException; dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)107 void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) 108 throws RemoteException; dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args)109 void dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args) 110 throws RemoteException; scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser, int processState)111 void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, 112 int resultCode, String data, Bundle extras, boolean ordered, 113 boolean sticky, int sendingUser, int processState) throws RemoteException; scheduleLowMemory()114 void scheduleLowMemory() throws RemoteException; scheduleActivityConfigurationChanged(IBinder token)115 void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; profilerControl(boolean start, String path, ParcelFileDescriptor fd, int profileType)116 void profilerControl(boolean start, String path, ParcelFileDescriptor fd, int profileType) 117 throws RemoteException; dumpHeap(boolean managed, String path, ParcelFileDescriptor fd)118 void dumpHeap(boolean managed, String path, ParcelFileDescriptor fd) 119 throws RemoteException; setSchedulingGroup(int group)120 void setSchedulingGroup(int group) throws RemoteException; 121 static final int PACKAGE_REMOVED = 0; 122 static final int EXTERNAL_STORAGE_UNAVAILABLE = 1; dispatchPackageBroadcast(int cmd, String[] packages)123 void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException; scheduleCrash(String msg)124 void scheduleCrash(String msg) throws RemoteException; dumpActivity(FileDescriptor fd, IBinder servicetoken, String prefix, String[] args)125 void dumpActivity(FileDescriptor fd, IBinder servicetoken, String prefix, String[] args) 126 throws RemoteException; setCoreSettings(Bundle coreSettings)127 void setCoreSettings(Bundle coreSettings) throws RemoteException; updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)128 void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) throws RemoteException; scheduleTrimMemory(int level)129 void scheduleTrimMemory(int level) throws RemoteException; dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, boolean dumpDalvik, String[] args)130 void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, 131 boolean dumpDalvik, String[] args) throws RemoteException; dumpGfxInfo(FileDescriptor fd, String[] args)132 void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException; dumpDbInfo(FileDescriptor fd, String[] args)133 void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException; unstableProviderDied(IBinder provider)134 void unstableProviderDied(IBinder provider) throws RemoteException; requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType)135 void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType) 136 throws RemoteException; scheduleTranslucentConversionComplete(IBinder token, boolean timeout)137 void scheduleTranslucentConversionComplete(IBinder token, boolean timeout) 138 throws RemoteException; setProcessState(int state)139 void setProcessState(int state) throws RemoteException; scheduleInstallProvider(ProviderInfo provider)140 void scheduleInstallProvider(ProviderInfo provider) throws RemoteException; 141 142 String descriptor = "android.app.IApplicationThread"; 143 144 int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; 145 int SCHEDULE_STOP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2; 146 int SCHEDULE_WINDOW_VISIBILITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3; 147 int SCHEDULE_RESUME_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4; 148 int SCHEDULE_SEND_RESULT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5; 149 int SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+6; 150 int SCHEDULE_NEW_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+7; 151 int SCHEDULE_FINISH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+8; 152 int SCHEDULE_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+9; 153 int SCHEDULE_CREATE_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+10; 154 int SCHEDULE_STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+11; 155 int BIND_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+12; 156 int SCHEDULE_EXIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+13; 157 int REQUEST_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+14; 158 int SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+15; 159 int SCHEDULE_SERVICE_ARGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+16; 160 int UPDATE_TIME_ZONE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+17; 161 int PROCESS_IN_BACKGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+18; 162 int SCHEDULE_BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+19; 163 int SCHEDULE_UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+20; 164 int DUMP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+21; 165 int SCHEDULE_REGISTERED_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+22; 166 int SCHEDULE_LOW_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+23; 167 int SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+24; 168 int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25; 169 int SCHEDULE_SLEEPING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26; 170 int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; 171 int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; 172 int SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29; 173 int SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30; 174 175 int SCHEDULE_SUICIDE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32; 176 int DISPATCH_PACKAGE_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33; 177 int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; 178 int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; 179 int DUMP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; 180 int CLEAR_DNS_CACHE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; 181 int SET_HTTP_PROXY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38; 182 int SET_CORE_SETTINGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39; 183 int UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40; 184 int SCHEDULE_TRIM_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41; 185 int DUMP_MEM_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+42; 186 int DUMP_GFX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+43; 187 int DUMP_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+44; 188 int DUMP_DB_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+45; 189 int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46; 190 int REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47; 191 int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48; 192 int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49; 193 int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50; 194 } 195