1 /* 2 * Copyright (C) 2020 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.app.ActivityManager; 20 import android.app.ICompatCameraControlCallback; 21 import android.app.IRequestFinishCallback; 22 import android.app.PictureInPictureParams; 23 import android.content.ComponentName; 24 import android.content.Intent; 25 import android.content.res.Configuration; 26 import android.os.Bundle; 27 import android.os.PersistableBundle; 28 import android.view.RemoteAnimationDefinition; 29 import android.window.SizeConfigurationBuckets; 30 31 import com.android.internal.policy.IKeyguardDismissCallback; 32 33 /** 34 * Interface for the callback and request from an activity to system. 35 * 36 * {@hide} 37 */ 38 interface IActivityClientController { activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling)39 oneway void activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling); activityResumed(in IBinder token, in boolean handleSplashScreenExit)40 oneway void activityResumed(in IBinder token, in boolean handleSplashScreenExit); activityRefreshed(in IBinder token)41 oneway void activityRefreshed(in IBinder token); 42 /** 43 * This call is not one-way because {@link #activityPaused()) is not one-way, or 44 * the top-resumed-lost could be reported after activity paused. 45 */ activityTopResumedStateLost()46 void activityTopResumedStateLost(); 47 /** 48 * Notifies that the activity has completed paused. This call is not one-way because it can make 49 * consecutive launch in the same process more coherent. About the order of binder call, it 50 * should be fine with other one-way calls because if pause hasn't completed on the server side, 51 * there won't be other lifecycle changes. 52 */ activityPaused(in IBinder token)53 void activityPaused(in IBinder token); activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description)54 oneway void activityStopped(in IBinder token, in Bundle state, 55 in PersistableBundle persistentState, in CharSequence description); activityDestroyed(in IBinder token)56 oneway void activityDestroyed(in IBinder token); activityLocalRelaunch(in IBinder token)57 oneway void activityLocalRelaunch(in IBinder token); activityRelaunched(in IBinder token)58 oneway void activityRelaunched(in IBinder token); 59 reportSizeConfigurations(in IBinder token, in SizeConfigurationBuckets sizeConfigurations)60 oneway void reportSizeConfigurations(in IBinder token, 61 in SizeConfigurationBuckets sizeConfigurations); moveActivityTaskToBack(in IBinder token, boolean nonRoot)62 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot); shouldUpRecreateTask(in IBinder token, in String destAffinity)63 boolean shouldUpRecreateTask(in IBinder token, in String destAffinity); navigateUpTo(in IBinder token, in Intent target, in String resolvedType, int resultCode, in Intent resultData)64 boolean navigateUpTo(in IBinder token, in Intent target, in String resolvedType, 65 int resultCode, in Intent resultData); releaseActivityInstance(in IBinder token)66 boolean releaseActivityInstance(in IBinder token); finishActivity(in IBinder token, int code, in Intent data, int finishTask)67 boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); finishActivityAffinity(in IBinder token)68 boolean finishActivityAffinity(in IBinder token); 69 /** Finish all activities that were started for result from the specified activity. */ finishSubActivity(in IBinder token, in String resultWho, int requestCode)70 void finishSubActivity(in IBinder token, in String resultWho, int requestCode); 71 /** 72 * Indicates that when the activity finsihes, the result should be immediately sent to the 73 * originating activity. Must only be invoked during MediaProjection setup. 74 */ 75 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)") setForceSendResultForMediaProjection(in IBinder token)76 void setForceSendResultForMediaProjection(in IBinder token); 77 isTopOfTask(in IBinder token)78 boolean isTopOfTask(in IBinder token); willActivityBeVisible(in IBinder token)79 boolean willActivityBeVisible(in IBinder token); getDisplayId(in IBinder activityToken)80 int getDisplayId(in IBinder activityToken); getTaskForActivity(in IBinder token, in boolean onlyRoot)81 int getTaskForActivity(in IBinder token, in boolean onlyRoot); 82 /** 83 * Returns the {@link Configuration} of the task which hosts the Activity, or {@code null} if 84 * the task {@link Configuration} cannot be obtained. 85 */ getTaskConfiguration(in IBinder activityToken)86 Configuration getTaskConfiguration(in IBinder activityToken); getActivityTokenBelow(IBinder token)87 IBinder getActivityTokenBelow(IBinder token); getCallingActivity(in IBinder token)88 ComponentName getCallingActivity(in IBinder token); getCallingPackage(in IBinder token)89 String getCallingPackage(in IBinder token); getLaunchedFromUid(in IBinder token)90 int getLaunchedFromUid(in IBinder token); getLaunchedFromPackage(in IBinder token)91 String getLaunchedFromPackage(in IBinder token); 92 setRequestedOrientation(in IBinder token, int requestedOrientation)93 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)94 int getRequestedOrientation(in IBinder token); 95 convertFromTranslucent(in IBinder token)96 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)97 boolean convertToTranslucent(in IBinder token, in Bundle options); 98 isImmersive(in IBinder token)99 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)100 void setImmersive(in IBinder token, boolean immersive); 101 enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)102 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)103 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays)104 oneway void setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays); toggleFreeformWindowingMode(in IBinder token)105 void toggleFreeformWindowingMode(in IBinder token); 106 startLockTaskModeByToken(in IBinder token)107 oneway void startLockTaskModeByToken(in IBinder token); stopLockTaskModeByToken(in IBinder token)108 oneway void stopLockTaskModeByToken(in IBinder token); showLockTaskEscapeMessage(in IBinder token)109 oneway void showLockTaskEscapeMessage(in IBinder token); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)110 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 111 showAssistFromActivity(in IBinder token, in Bundle args)112 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)113 boolean isRootVoiceInteraction(in IBinder token); startLocalVoiceInteraction(in IBinder token, in Bundle options)114 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)115 void stopLocalVoiceInteraction(in IBinder token); 116 setShowWhenLocked(in IBinder token, boolean showWhenLocked)117 oneway void setShowWhenLocked(in IBinder token, boolean showWhenLocked); setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)118 oneway void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked); setTurnScreenOn(in IBinder token, boolean turnScreenOn)119 oneway void setTurnScreenOn(in IBinder token, boolean turnScreenOn); reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)120 oneway void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle); 121 /** 122 * Overrides the animation of activity pending transition. This call is not one-way because 123 * the method is usually used after startActivity or Activity#finish. If this is non-blocking, 124 * the calling activity may proceed to complete pause and become stopping state, which will 125 * cause the request to be ignored. Besides, startActivity and Activity#finish are blocking 126 * calls, so this method should be the same as them to keep the invocation order. 127 */ overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim, int backgroundColor)128 void overridePendingTransition(in IBinder token, in String packageName, 129 int enterAnim, int exitAnim, int backgroundColor); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)130 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 131 132 /** See {@link android.app.Activity#setRecentsScreenshotEnabled}. */ setRecentsScreenshotEnabled(in IBinder token, boolean enabled)133 oneway void setRecentsScreenshotEnabled(in IBinder token, boolean enabled); 134 135 /** 136 * It should only be called from home activity to remove its outdated snapshot. The home 137 * snapshot is used to speed up entering home from screen off. If the content of home activity 138 * is significantly different from before taking the snapshot, then the home activity can use 139 * this method to avoid inconsistent transition. 140 */ invalidateHomeTaskSnapshot(IBinder homeToken)141 void invalidateHomeTaskSnapshot(IBinder homeToken); 142 dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)143 void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, 144 in CharSequence message); 145 146 /** Registers remote animations for a specific activity. */ registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)147 void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition); 148 149 /** Unregisters all remote animations for a specific activity. */ unregisterRemoteAnimations(in IBinder token)150 void unregisterRemoteAnimations(in IBinder token); 151 152 /** 153 * Reports that an Activity received a back key press. 154 */ onBackPressed(in IBinder activityToken, in IRequestFinishCallback callback)155 oneway void onBackPressed(in IBinder activityToken, 156 in IRequestFinishCallback callback); 157 158 /** Reports that the splash screen view has attached to activity. */ splashScreenAttached(in IBinder token)159 oneway void splashScreenAttached(in IBinder token); 160 161 /** 162 * Shows or hides a Camera app compat toggle for stretched issues with the requested state. 163 * 164 * @param token The token for the window that needs a control. 165 * @param showControl Whether the control should be shown or hidden. 166 * @param transformationApplied Whether the treatment is already applied. 167 * @param callback The callback executed when the user clicks on a control. 168 */ requestCompatCameraControl(in IBinder token, boolean showControl, boolean transformationApplied, in ICompatCameraControlCallback callback)169 oneway void requestCompatCameraControl(in IBinder token, boolean showControl, 170 boolean transformationApplied, in ICompatCameraControlCallback callback); 171 } 172