1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
| public static final class ActivityClientRecord { @UnsupportedAppUsage public IBinder token; public IBinder assistToken; public IBinder shareableActivityToken; @Nullable public IBinder mInitialTaskFragmentToken; int ident; @UnsupportedAppUsage Intent intent; String referrer; IVoiceInteractor voiceInteractor; Bundle state; PersistableBundle persistentState; @UnsupportedAppUsage Activity activity; Window window; Activity parent; String embeddedID; Activity.NonConfigurationInstances lastNonConfigurationInstances; @UnsupportedAppUsage boolean paused; @UnsupportedAppUsage boolean stopped; boolean hideForNow; Configuration createdConfig; Configuration overrideConfig; private Configuration tmpConfig = new Configuration(); ViewRootImpl.ActivityConfigCallback activityConfigCallback; ActivityClientRecord nextIdle;
boolean isTopResumedActivity; boolean lastReportedTopResumedState;
ProfilerInfo profilerInfo;
@UnsupportedAppUsage ActivityInfo activityInfo; @UnsupportedAppUsage CompatibilityInfo compatInfo; @UnsupportedAppUsage public LoadedApk packageInfo;
List<ResultInfo> pendingResults; List<ReferrerIntent> pendingIntents;
boolean startsNotResumed; public final boolean isForward; int pendingConfigChanges; boolean mIsUserLeaving;
Window mPendingRemoveWindow; WindowManager mPendingRemoveWindowManager; @UnsupportedAppUsage boolean mPreserveWindow;
ActivityOptions mActivityOptions;
boolean mLaunchedFromBubble;
@LifecycleState private int mLifecycleState = PRE_ON_CREATE;
private SizeConfigurationBuckets mSizeConfigurations;
@VisibleForTesting @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public ActivityClientRecord() { this.isForward = false; init(); }
public ActivityClientRecord(IBinder token, Intent intent, int ident, ActivityInfo info, Configuration overrideConfig, CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor, Bundle state, PersistableBundle persistentState, List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions, boolean isForward, ProfilerInfo profilerInfo, ClientTransactionHandler client, IBinder assistToken, IBinder shareableActivityToken, boolean launchedFromBubble, IBinder initialTaskFragmentToken) { this.token = token; this.assistToken = assistToken; this.shareableActivityToken = shareableActivityToken; this.ident = ident; this.intent = intent; this.referrer = referrer; this.voiceInteractor = voiceInteractor; this.activityInfo = info; this.compatInfo = compatInfo; this.state = state; this.persistentState = persistentState; this.pendingResults = pendingResults; this.pendingIntents = pendingNewIntents; this.isForward = isForward; this.profilerInfo = profilerInfo; this.overrideConfig = overrideConfig; this.packageInfo = client.getPackageInfoNoCheck(activityInfo.applicationInfo, compatInfo); mActivityOptions = activityOptions; mLaunchedFromBubble = launchedFromBubble; mInitialTaskFragmentToken = initialTaskFragmentToken; init(); }
private void init() { parent = null; embeddedID = null; paused = false; stopped = false; hideForNow = false; nextIdle = null; activityConfigCallback = new ViewRootImpl.ActivityConfigCallback() { @Override public void onConfigurationChanged(Configuration overrideConfig, int newDisplayId) { if (activity == null) { throw new IllegalStateException( "Received config update for non-existing activity"); } activity.mMainThread.handleActivityConfigurationChanged( ActivityClientRecord.this, overrideConfig, newDisplayId); }
@Override public void requestCompatCameraControl(boolean showControl, boolean transformationApplied, ICompatCameraControlCallback callback) { if (activity == null) { throw new IllegalStateException( "Received camera compat control update for non-existing activity"); } ActivityClient.getInstance().requestCompatCameraControl( activity.getResources(), token, showControl, transformationApplied, callback); }
}; }
public int getLifecycleState() { return mLifecycleState; }
public void setState(@LifecycleState int newLifecycleState) { mLifecycleState = newLifecycleState; switch (mLifecycleState) { case ON_CREATE: paused = true; stopped = true; break; case ON_START: paused = true; stopped = false; break; case ON_RESUME: paused = false; stopped = false; break; case ON_PAUSE: paused = true; stopped = false; break; case ON_STOP: paused = true; stopped = true; break; } }
private boolean isPreHoneycomb() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB; }
private boolean isPreP() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.P; }
public boolean isPersistable() { return activityInfo.persistableMode == ActivityInfo.PERSIST_ACROSS_REBOOTS; }
public boolean isVisibleFromServer() { return activity != null && activity.mVisibleFromServer; }
public String toString() { ComponentName componentName = intent != null ? intent.getComponent() : null; return "ActivityRecord{" + Integer.toHexString(System.identityHashCode(this)) + " token=" + token + " " + (componentName == null ? "no component name" : componentName.toShortString()) + "}"; }
public String getStateString() { StringBuilder sb = new StringBuilder(); sb.append("ActivityClientRecord{"); sb.append("paused=").append(paused); sb.append(", stopped=").append(stopped); sb.append(", hideForNow=").append(hideForNow); sb.append(", startsNotResumed=").append(startsNotResumed); sb.append(", isForward=").append(isForward); sb.append(", pendingConfigChanges=").append(pendingConfigChanges); sb.append(", preserveWindow=").append(mPreserveWindow); if (activity != null) { sb.append(", Activity{"); sb.append("resumed=").append(activity.mResumed); sb.append(", stopped=").append(activity.mStopped); sb.append(", finished=").append(activity.isFinishing()); sb.append(", destroyed=").append(activity.isDestroyed()); sb.append(", startedActivity=").append(activity.mStartedActivity); sb.append(", changingConfigurations=").append(activity.mChangingConfigurations); sb.append("}"); } sb.append("}"); return sb.toString(); } }
|