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.Configuration; 27 import android.os.Bundle; 28 import android.os.Debug; 29 import android.os.ParcelFileDescriptor; 30 import android.os.RemoteException; 31 import android.os.IBinder; 32 import android.os.IInterface; 33 34 import java.io.FileDescriptor; 35 import java.util.List; 36 import java.util.Map; 37 38 /** 39 * System private API for communicating with the application. This is given to 40 * the activity manager by an application when it starts up, for the activity 41 * manager to tell the application about things it needs to do. 42 * 43 * {@hide} 44 */ 45 public interface IApplicationThread extends IInterface { schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving, int configChanges)46 void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving, 47 int configChanges) throws RemoteException; scheduleStopActivity(IBinder token, boolean showWindow, int configChanges)48 void scheduleStopActivity(IBinder token, boolean showWindow, 49 int configChanges) throws RemoteException; scheduleWindowVisibility(IBinder token, boolean showWindow)50 void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException; scheduleResumeActivity(IBinder token, boolean isForward)51 void scheduleResumeActivity(IBinder token, boolean isForward) throws RemoteException; scheduleSendResult(IBinder token, List<ResultInfo> results)52 void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException; scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward)53 void scheduleLaunchActivity(Intent intent, IBinder token, int ident, 54 ActivityInfo info, Bundle state, List<ResultInfo> pendingResults, 55 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward) 56 throws RemoteException; scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, int configChanges, boolean notResumed, Configuration config)57 void scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults, 58 List<Intent> pendingNewIntents, int configChanges, 59 boolean notResumed, Configuration config) throws RemoteException; scheduleNewIntent(List<Intent> intent, IBinder token)60 void scheduleNewIntent(List<Intent> intent, IBinder token) throws RemoteException; scheduleDestroyActivity(IBinder token, boolean finished, int configChanges)61 void scheduleDestroyActivity(IBinder token, boolean finished, 62 int configChanges) throws RemoteException; scheduleReceiver(Intent intent, ActivityInfo info, int resultCode, String data, Bundle extras, boolean sync)63 void scheduleReceiver(Intent intent, ActivityInfo info, int resultCode, 64 String data, Bundle extras, boolean sync) throws RemoteException; 65 static final int BACKUP_MODE_INCREMENTAL = 0; 66 static final int BACKUP_MODE_FULL = 1; 67 static final int BACKUP_MODE_RESTORE = 2; scheduleCreateBackupAgent(ApplicationInfo app, int backupMode)68 void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode) throws RemoteException; scheduleDestroyBackupAgent(ApplicationInfo app)69 void scheduleDestroyBackupAgent(ApplicationInfo app) throws RemoteException; scheduleCreateService(IBinder token, ServiceInfo info)70 void scheduleCreateService(IBinder token, ServiceInfo info) throws RemoteException; scheduleBindService(IBinder token, Intent intent, boolean rebind)71 void scheduleBindService(IBinder token, 72 Intent intent, boolean rebind) throws RemoteException; scheduleUnbindService(IBinder token, Intent intent)73 void scheduleUnbindService(IBinder token, 74 Intent intent) throws RemoteException; scheduleServiceArgs(IBinder token, int startId, int flags, Intent args)75 void scheduleServiceArgs(IBinder token, int startId, int flags, Intent args) 76 throws RemoteException; scheduleStopService(IBinder token)77 void scheduleStopService(IBinder token) throws RemoteException; 78 static final int DEBUG_OFF = 0; 79 static final int DEBUG_ON = 1; 80 static final int DEBUG_WAIT = 2; bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, String profileName, Bundle testArguments, IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode, Configuration config, Map<String, IBinder> services)81 void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, 82 ComponentName testName, String profileName, Bundle testArguments, 83 IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode, 84 Configuration config, Map<String, IBinder> services) throws RemoteException; scheduleExit()85 void scheduleExit() throws RemoteException; scheduleSuicide()86 void scheduleSuicide() throws RemoteException; requestThumbnail(IBinder token)87 void requestThumbnail(IBinder token) throws RemoteException; scheduleConfigurationChanged(Configuration config)88 void scheduleConfigurationChanged(Configuration config) throws RemoteException; updateTimeZone()89 void updateTimeZone() throws RemoteException; processInBackground()90 void processInBackground() throws RemoteException; dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)91 void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) 92 throws RemoteException; scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky)93 void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, 94 int resultCode, String data, Bundle extras, boolean ordered, boolean sticky) 95 throws RemoteException; scheduleLowMemory()96 void scheduleLowMemory() throws RemoteException; scheduleActivityConfigurationChanged(IBinder token)97 void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; profilerControl(boolean start, String path, ParcelFileDescriptor fd)98 void profilerControl(boolean start, String path, ParcelFileDescriptor fd) 99 throws RemoteException; setSchedulingGroup(int group)100 void setSchedulingGroup(int group) throws RemoteException; getMemoryInfo(Debug.MemoryInfo outInfo)101 void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException; 102 static final int PACKAGE_REMOVED = 0; 103 static final int EXTERNAL_STORAGE_UNAVAILABLE = 1; dispatchPackageBroadcast(int cmd, String[] packages)104 void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException; scheduleCrash(String msg)105 void scheduleCrash(String msg) throws RemoteException; 106 107 String descriptor = "android.app.IApplicationThread"; 108 109 int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; 110 int SCHEDULE_STOP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2; 111 int SCHEDULE_WINDOW_VISIBILITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3; 112 int SCHEDULE_RESUME_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4; 113 int SCHEDULE_SEND_RESULT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5; 114 int SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+6; 115 int SCHEDULE_NEW_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+7; 116 int SCHEDULE_FINISH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+8; 117 int SCHEDULE_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+9; 118 int SCHEDULE_CREATE_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+10; 119 int SCHEDULE_STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+11; 120 int BIND_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+12; 121 int SCHEDULE_EXIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+13; 122 int REQUEST_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+14; 123 int SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+15; 124 int SCHEDULE_SERVICE_ARGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+16; 125 int UPDATE_TIME_ZONE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+17; 126 int PROCESS_IN_BACKGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+18; 127 int SCHEDULE_BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+19; 128 int SCHEDULE_UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+20; 129 int DUMP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+21; 130 int SCHEDULE_REGISTERED_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+22; 131 int SCHEDULE_LOW_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+23; 132 int SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+24; 133 int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25; 134 135 int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; 136 int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; 137 int SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29; 138 int SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30; 139 int GET_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31; 140 int SCHEDULE_SUICIDE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32; 141 int DISPATCH_PACKAGE_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33; 142 int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; 143 } 144