一、概括
Activity的启动模式主要分为四种:standard(标准模式)、singleTop(栈顶复用模式)、singleTask(栈内复用模式)和singleInstance(单例模式)。每种模式都有其特定的行为和用途:
-
Standard模式:这是Activity的默认启动模式。在这种模式下,每次启动一个新的Activity时,都会创建一个新的Activity实例,并将其添加到任务栈中。如果Activity已经存在于任务栈中,系统不会复用已有的实例,而是创建一个新的实例。
-
SingleTop模式:如果Activity已经在任务栈的栈顶,再次启动该Activity时,系统不会创建新的实例,而是复用已有的实例。这种情况下,不会调用onCreate()或onStart()生命周期方法,而是调用onNewIntent()方法来处理传递的参数。如果Activity不在栈顶,则会创建新的实例。
-
SingleTask模式:在这种模式下,如果Activity已经存在于任务栈中,系统会将其移到栈顶,而不是创建新的实例。如果Activity不在栈中,则会创建一个新的实例。与SingleTop模式类似,SingleTask模式也会清除该Activity之上的所有Activity实例。此外,SingleTask模式的Activity可以与taskAffinity和allowTaskReparenting属性一起使用,以指定Activity的独立运行任务栈。
-
SingleInstance模式:这是加强版的SingleTask模式,它确保Activity在单独的任务栈中运行。这种模式下,无论何时启动该Activity,系统都会确保它在一个单独的任务栈中运行,且不会创建多个实例。这种模式适用于需要确保Activity始终单独运行的情况,如登录页面。
启动模式的设置可以通过两种方式进行:在AndroidManifest.xml文件中直接设置android属性,或者在Intent中使用特定的标志位(如FLAG_ACTIVITY_NEW_TASK等)来动态指定。
二、使用adb shell dumpsys activity activities查看栈信息
<applicationandroid:allowBackup="true"android:dataExtractionRules="@xml/data_extraction_rules"android:fullBackupContent="@xml/backup_rules"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"android:theme="@style/Theme.AndroidActivityLife"tools:targetApi="31"><activityandroid:name="com.aniljing.androidactivitylife.lifeDetail.HomeActivity"android:launchMode="standard"android:exported="true"><intent-filter><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/><category android:name="android.intent.category.HOME"/></intent-filter></activity><activityandroid:name="com.aniljing.androidactivitylife.lifeDetail.AActivity"android:launchMode="singleTask" /><activityandroid:name="com.aniljing.androidactivitylife.lifeDetail.BActivity"android:launchMode="singleInstance" /><activityandroid:name="com.aniljing.androidactivitylife.lifeDetail.CActivity"android:launchMode="singleTop" /></application>
定义了4个Activity,其中HomeActivity是standard模式,AActivity是singleTask模式,BActivity是singleInstance模式,CActivity是singleTop。
2-1、场景一:Home->A->C
adb shell dumpsys activity activities
Display #0 (activities from top to bottom):Stack #1:mFullscreen=trueisSleeping=falsemBounds=nullTask id #9 ①mFullscreen=truemBounds=nullmMinWidth=-1mMinHeight=-1mLastNonFullscreenBounds=null* TaskRecord{b8509c4 #9 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=3}userId=0 effectiveUid=u0a37 mCallingUid=2000 mUserSetupComplete=true mCallingPackage=nullaffinity=com.aniljing.androidactivitylifeintent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.HomeActivity}realActivity=com.aniljing.androidactivitylife/.lifeDetail.HomeActivityautoRemoveRecents=false isPersistable=true numFullscreen=3 taskType=0 mTaskToReturnTo=0rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLEActivities=[ActivityRecord{a880e1e u0 com.aniljing.androidactivitylife/.lifeDetail.HomeActivity t9}, ActivityRecord{89068c1 u0 com.aniljing.androidactivitylife/.lifeDetail.AActivity t9}, ActivityRecord{5b51514 u0 com.aniljing.androidactivitylife/.lifeDetail.CActivity t9}]askedCompatMode=false inRecents=true isAvailable=truelastThumbnail=null lastThumbnailFile=/data/system_ce/0/recent_images/9_task_thumbnail.pngstackId=1hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mSupportsPictureInPicture=false isResizeable=true firstActiveTime=1720340688750 lastActiveTime=1720340689574 (inactive for 4s)* Hist #2: ActivityRecord{5b51514 u0 com.aniljing.androidactivitylife/.lifeDetail.CActivity t9}packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=10037 launchedFromPackage=com.aniljing.androidactivitylife userId=0app=ProcessRecord{6ae50e8 13405:com.aniljing.androidactivitylife/u0a37}Intent { cmp=com.aniljing.androidactivitylife/.lifeDetail.CActivity } ②frontOfTask=false task=TaskRecord{b8509c4 #9 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=3}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.CActivitybaseDir=/data/app/com.aniljing.androidactivitylife-1YbP4BM7uXQ61MBRLwJ4kA==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=1 lastLaunchTime=-4s241mshaveState=false icicle=nullstate=RESUMED stopped=false delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=true sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_SHOWNfullscreen=true noDisplay=false immersive=false launchMode=1frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEwaitingVisible=false nowVisible=true lastVisibleTime=-4s36msresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false* Hist #1: ActivityRecord{89068c1 u0 com.aniljing.androidactivitylife/.lifeDetail.AActivity t9} ③packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=10037 launchedFromPackage=com.aniljing.androidactivitylife userId=0app=ProcessRecord{6ae50e8 13405:com.aniljing.androidactivitylife/u0a37}Intent { flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.AActivity }frontOfTask=false task=TaskRecord{b8509c4 #9 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=3}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.AActivitybaseDir=/data/app/com.aniljing.androidactivitylife-1YbP4BM7uXQ61MBRLwJ4kA==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=0 lastLaunchTime=-4s494mshaveState=true icicle=Bundle[mParcelledData.dataSize=2192]state=STOPPED stopped=true delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_REMOVEDfullscreen=true noDisplay=false immersive=false launchMode=2frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false* Hist #0: ActivityRecord{a880e1e u0 com.aniljing.androidactivitylife/.lifeDetail.HomeActivity t9} ④packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=2000 launchedFromPackage=null userId=0app=ProcessRecord{6ae50e8 13405:com.aniljing.androidactivitylife/u0a37}Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.HomeActivity }frontOfTask=true task=TaskRecord{b8509c4 #9 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=3}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.HomeActivitybaseDir=/data/app/com.aniljing.androidactivitylife-1YbP4BM7uXQ61MBRLwJ4kA==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=0 lastLaunchTime=-4s879mshaveState=true icicle=Bundle[mParcelledData.dataSize=2192]state=STOPPED stopped=true delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_REMOVEDfullscreen=true noDisplay=false immersive=false launchMode=0frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false
①标注出了当前任务栈id
②是CActivity的信息
③是AActivity的信息
④是HomeActivity的信息
上面的信息可以看出,三个Activity还是在同一个任务栈里面
2-2、场景二:Home->B->C
其中BActivity的启动模式是SingleInstance。
adb shell dumpsys activity activities
Display #0 (activities from top to bottom):Stack #1:mFullscreen=trueisSleeping=falsemBounds=nullTask id #10 ①mFullscreen=truemBounds=nullmMinWidth=-1mMinHeight=-1mLastNonFullscreenBounds=null* TaskRecord{133951a #10 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=2}userId=0 effectiveUid=u0a37 mCallingUid=2000 mUserSetupComplete=true mCallingPackage=nullaffinity=com.aniljing.androidactivitylifeintent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.HomeActivity}realActivity=com.aniljing.androidactivitylife/.lifeDetail.HomeActivityautoRemoveRecents=false isPersistable=true numFullscreen=2 taskType=0 mTaskToReturnTo=0rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLEActivities=[ActivityRecord{f48d68 u0 com.aniljing.androidactivitylife/.lifeDetail.HomeActivity t10}, ActivityRecord{52371f4 u0 com.aniljing.androidactivitylife/.lifeDetail.CActivity t10}]askedCompatMode=false inRecents=true isAvailable=truelastThumbnail=null lastThumbnailFile=/data/system_ce/0/recent_images/10_task_thumbnail.pngstackId=1hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mSupportsPictureInPicture=false isResizeable=true firstActiveTime=1720341696957 lastActiveTime=1720341697833 (inactive for 12s)* Hist #1: ActivityRecord{52371f4 u0 com.aniljing.androidactivitylife/.lifeDetail.CActivity t10} ②packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=10037 launchedFromPackage=com.aniljing.androidactivitylife userId=0app=ProcessRecord{68fa95e 14214:com.aniljing.androidactivitylife/u0a37}Intent { flg=0x10400000 cmp=com.aniljing.androidactivitylife/.lifeDetail.CActivity }frontOfTask=false task=TaskRecord{133951a #10 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=2}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.CActivitybaseDir=/data/app/com.aniljing.androidactivitylife-P4lV_AAI0_HaUjv6Ao_fLw==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=1 lastLaunchTime=-12s756mshaveState=false icicle=nullstate=RESUMED stopped=false delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=true sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_NOT_SHOWNfullscreen=true noDisplay=false immersive=false launchMode=1frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEwaitingVisible=false nowVisible=true lastVisibleTime=-12s127msresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false* Hist #0: ActivityRecord{f48d68 u0 com.aniljing.androidactivitylife/.lifeDetail.HomeActivity t10} ③packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=2000 launchedFromPackage=null userId=0app=ProcessRecord{68fa95e 14214:com.aniljing.androidactivitylife/u0a37}Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.HomeActivity }frontOfTask=true task=TaskRecord{133951a #10 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=2}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.HomeActivitybaseDir=/data/app/com.aniljing.androidactivitylife-P4lV_AAI0_HaUjv6Ao_fLw==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=1 lastLaunchTime=-13s412mshaveState=false icicle=nullstate=PAUSED stopped=false delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_REMOVEDfullscreen=true noDisplay=false immersive=false launchMode=0frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=falseTask id #11 ④mFullscreen=truemBounds=nullmMinWidth=-1mMinHeight=-1mLastNonFullscreenBounds=null* TaskRecord{d6b2c71 #11 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=1}userId=0 effectiveUid=u0a37 mCallingUid=u0a37 mUserSetupComplete=true mCallingPackage=com.aniljing.androidactivitylifeaffinity=com.aniljing.androidactivitylifeintent={flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.BActivity}realActivity=com.aniljing.androidactivitylife/.lifeDetail.BActivityautoRemoveRecents=false isPersistable=true numFullscreen=1 taskType=0 mTaskToReturnTo=0rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLEActivities=[ActivityRecord{b1c04f7 u0 com.aniljing.androidactivitylife/.lifeDetail.BActivity t11}]askedCompatMode=false inRecents=false isAvailable=truelastThumbnail=null lastThumbnailFile=/data/system_ce/0/recent_images/11_task_thumbnail.pngstackId=1hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mSupportsPictureInPicture=false isResizeable=true firstActiveTime=1720341697464 lastActiveTime=1720341697779 (inactive for 12s)* Hist #0: ActivityRecord{b1c04f7 u0 com.aniljing.androidactivitylife/.lifeDetail.BActivity t11} ⑤packageName=com.aniljing.androidactivitylife processName=com.aniljing.androidactivitylifelaunchedFromUid=10037 launchedFromPackage=com.aniljing.androidactivitylife userId=0app=ProcessRecord{68fa95e 14214:com.aniljing.androidactivitylife/u0a37}Intent { flg=0x10000000 cmp=com.aniljing.androidactivitylife/.lifeDetail.BActivity }frontOfTask=true task=TaskRecord{d6b2c71 #11 A=com.aniljing.androidactivitylife U=0 StackId=1 sz=1}taskAffinity=com.aniljing.androidactivityliferealActivity=com.aniljing.androidactivitylife/.lifeDetail.BActivitybaseDir=/data/app/com.aniljing.androidactivitylife-P4lV_AAI0_HaUjv6Ao_fLw==/base.apkdataDir=/data/user/0/com.aniljing.androidactivitylifestateNotNeeded=false componentSpecified=true mActivityType=0compat={480dpi} labelRes=0x7f0f001c icon=0x7f0d0000 theme=0x7f10020bmLastReportedConfigurations:mGlobalConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}mOverrideConfig={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}CurrentConfiguration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2160) s.7 themeId=0}taskDescription: iconFilename=null label="null" primaryColor=ff6200eebackgroundColor=ffffffffstatusBarColor=ff3700b3navigationBarColor=fff6f6f6launchFailed=false launchCount=0 lastLaunchTime=-12s976mshaveState=true icicle=Bundle[mParcelledData.dataSize=2192]state=STOPPED stopped=true delayedResume=false finishing=falsekeysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_REMOVEDfullscreen=true noDisplay=false immersive=false launchMode=3frozenBeforeDestroy=false forceNewConfig=falsemActivityType=APPLICATION_ACTIVITY_TYPEresizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false
①第一个任务栈ID
②CActivity
③HomeActivity
④第二个任务栈ID
⑤BActivity
HomeActivity和CActivity同属于一个任务栈,而BActivity的启动模式是SingleInstance,所以它单独一个任务栈