淘宝做导航网站好,免费咨询妇科医生,网站盈利的10种方式,做亚马逊有什么网站可以借鉴我们在ActivityStack类中可以看到某个方法用于返回当前任务栈顶端的ActivityRecord对象#xff0c;如果栈是空的#xff0c;就返回null#xff0c;ActivityRecord用于代表在历史任务栈中的一个Activity对象的信息。 /*** Returns the top activity in any existing task ma…我们在ActivityStack类中可以看到某个方法用于返回当前任务栈顶端的ActivityRecord对象如果栈是空的就返回nullActivityRecord用于代表在历史任务栈中的一个Activity对象的信息。 /*** Returns the top activity in any existing task matching the given* Intent. Returns null if no such task is found.*/private ActivityRecord findTaskLocked(Intent intent, ActivityInfo info) {ComponentName cls intent.getComponent();if (info.targetActivity ! null) {cls new ComponentName(info.packageName, info.targetActivity);}TaskRecord cp null;final int N mHistory.size();for (int i(N-1); i0; i--) {ActivityRecord r (ActivityRecord)mHistory.get(i);if (!r.finishing r.task ! cp r.launchMode ! ActivityInfo.LAUNCH_SINGLE_INSTANCE) {cp r.task;//Slog.i(TAG, Comparing existing cls r.task.intent.getComponent().flattenToShortString()// /aff r.task.affinity to new cls// intent.getComponent().flattenToShortString() /aff taskAffinity);if (r.task.affinity ! null) {if (r.task.affinity.equals(info.taskAffinity)) {//Slog.i(TAG, Found matching affinity!);return r;}} else if (r.task.intent ! null r.task.intent.getComponent().equals(cls)) {//Slog.i(TAG, Found matching class!);//dump();//Slog.i(TAG, For Intent intent bringing to top: r.intent);return r;} else if (r.task.affinityIntent ! null r.task.affinityIntent.getComponent().equals(cls)) {//Slog.i(TAG, Found matching class!);//dump();//Slog.i(TAG, For Intent intent bringing to top: r.intent);return r;}}}return null;贴一下ActivityRecord类的信息 /*** An entry in the history stack, representing an activity.*/
class ActivityRecord extends IApplicationToken.Stub {final ActivityManagerService service; // ownerfinal ActivityStack stack; // ownerfinal ActivityInfo info; // all about mefinal int launchedFromUid; // always the uid who started the activity.final Intent intent; // the original intent that generated usfinal ComponentName realActivity; // the intent component, or target of an alias.final String shortComponentName; // the short component name of the intentfinal String resolvedType; // as per original caller;final String packageName; // the package implementing intents componentfinal String processName; // process where this component wants to runfinal String taskAffinity; // as per ActivityInfo.taskAffinityfinal boolean stateNotNeeded; // As per ActivityInfo.flagsfinal boolean fullscreen; // covers the full screen?final boolean componentSpecified; // did caller specifiy an explicit component?final boolean isHomeActivity; // do we consider this to be a home activity?final String baseDir; // where activity source (resources etc) locatedfinal String resDir; // where public activity source (public resources etc) locatedfinal String dataDir; // where activity data should goCharSequence nonLocalizedLabel; // the label information from the package mgr.int labelRes; // the label information from the package mgr.int icon; // resource identifier of activitys icon.int theme; // resource identifier of activitys theme.TaskRecord task; // the task this is in.long launchTime; // when we starting launching this activitylong startTime; // last time this activity was startedlong cpuTimeAtResume; // the cpu time of host process at the time of resuming activityConfiguration configuration; // configuration activity was last running inActivityRecord resultTo; // who started this entry, so will get our replyfinal String resultWho; // additional identifier for use by resultTo.final int requestCode; // code given by requester (resultTo)ArrayList results; // pending ActivityResult objs we have receivedHashSetWeakReferencePendingIntentRecord pendingResults; // all pending intents for this actArrayList newIntents; // any pending new intents for single-top modeHashSetConnectionRecord connections; // All ConnectionRecord we holdUriPermissionOwner uriPermissions; // current special URI access perms.ProcessRecord app; // if non-null, hosting applicationBitmap thumbnail; // icon representation of paused screenCharSequence description; // textual description of paused screenActivityState state; // current state we are inBundle icicle; // last saved activity stateboolean frontOfTask; // is this the root activity of its task?boolean launchFailed; // set if a launched failed, to abort on 2nd tryboolean haveState; // have we gotten the last activity state?boolean stopped; // is activity pause finished?boolean delayedResume; // not yet resumed because of stopped app switches?boolean finishing; // activity in pending finish list?boolean configDestroy; // need to destroy due to config change?int configChangeFlags; // which config values have changedboolean keysPaused; // has key dispatching been paused for it?boolean inHistory; // are we in the history stack?int launchMode; // the launch mode activity attribute.boolean visible; // does this activitys window need to be shown?boolean waitingVisible; // true if waiting for a new act to become visboolean nowVisible; // is this activitys window visible?boolean thumbnailNeeded;// has someone requested a thumbnail?boolean idle; // has the activity gone idle?boolean hasBeenLaunched;// has this activity ever been launched?boolean frozenBeforeDestroy;// has been frozen but not yet destroyed.String stringName; // for caching of toString().