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