Activity启动模式探究

一、概括

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,所以它单独一个任务栈

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/42437.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

日常学习--20240705

1、IO流 按照IO操作的数据类型分为字节流和字符流&#xff1a; 字节流&#xff1a;又分为输入流&#xff08;其他程序传递过来的数据&#xff0c;读取流中的数据&#xff09;和输出流&#xff08;往流中写数据&#xff0c;传递给其他程序&#xff09;;可以操作二进制文件&…

国内采用docker部署open-metadata

背景 最近看看开源的元数据管理项目&#xff0c;比较出名点的有open-metadata、datahub、OpenLineage、atlas。 open-metadata有1千多的贡献者&#xff0c;4.8K的stars&#xff0c;社区现在也比较活跃&#xff0c;支持的数据库类型还蛮多&#xff0c;基本市面上常见的都有支持…

使用Python连接本地MySQL数据库并创建表后添加数据

一、使用Python连接本地MySQL数据库并创建表后添加数据 端口号&#xff1a;3307 用户名&#xff1a;root 密码&#xff1a;lms123456 数据库&#xff1a;test_01 from orm import *# 数据库连接对象 db MySQLDatabase(host"localhost",port3307,user"root…

【每日一练】python三目运算符的用法

""" 三目运算符与基础运算的对比 """ a 1 b 2#1.基础if运算判断写法&#xff1a; if a > b:print("基础判断输出&#xff1a;a大于b") else:print("基础判断输出&#xff1a; a不大于b")#2.三目运算法判断&#xff1a;…

揭秘IP:从虚拟地址到现实世界的精准定位

1.IP地址介绍 1.内网 IP 地址&#xff08;私有 IP 地址&#xff09; 内网 IP 地址&#xff0c;即私有 IP 地址&#xff0c;是在局域网&#xff08;LAN&#xff09;内部使用的 IP 地址。这些地址不会在公共互联网中路由&#xff0c;因此可以在多个局域网中重复使用。私有 IP 地…

股票Level-2行情是什么,应该怎么使用,从哪里获取数据

行情接入方法 level2行情websocket接入方法-CSDN博客 相比传统的股票行情&#xff0c;Level-2行情为投资者打开了更广阔的视野&#xff0c;不仅限于买一卖一的表面数据&#xff0c;而是深入到市场的核心&#xff0c;提供了十档乃至千档的行情信息&#xff08;沪市十档&#…

解决Java中的跨平台开发与部署问题

解决Java中的跨平台开发与部署问题 大家好&#xff0c;我是微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01; 1. 跨平台开发的挑战与需求 随着软件应用的普及和多样化&#xff0c;开发人员经常面临将应用程序在不同操作系统…

STM32第十六课:WiFi模块的配置及应用

文章目录 需求一、WiFi模块概要二、配置流程1.配置通信串口&#xff0c;引脚和中断2.AT指令3.发送逻辑编写 三、需求实现代码总结 需求 完成WiFi模块的配置,使其最终能和服务器相互发送消息。 一、WiFi模块概要 本次使用的WiFi模块为ESP-12F模块&#xff08;安信可&#xf…

【LLM第8篇】Delta Tuning

如何对large-scale PLM进行调整呢&#xff1f; 一个有效的方式是delta tuning&#xff1b;只更新PLM中的一小部分参数&#xff0c;其它参数不动。 把解决任务的能力具象化成delta object这样的参数&#xff0c;只需要几十兆参数存储。 过去模型参数是随机的&#xff0c;现在预…

【MySQL】逻辑架构与存储引擎

一、逻辑架构 1、MySQL逻辑架构 我们可以根据上图来对sql的执行过程进行分析 第一步&#xff1a;客户端与服务器建立一个连接&#xff0c;从连接池中分配一个线程处理SQL语句第二步&#xff1a;SQL接口接受SQL指令第三步&#xff1a;如果是5.7版本&#xff0c;就会先去缓存中…

Git 一种分布式版本控制系统

Git 是一种分布式版本控制系统&#xff0c;用于管理和追踪文件的修改历史。它具有以下基本概念和使用方式&#xff1a; 仓库&#xff08;Repository&#xff09;&#xff1a;Git 将文件存储在仓库中&#xff0c;并记录文件的修改历史。仓库可以是本地仓库或远程仓库&#xff0c…

Python字符串处理常用的30种操作

我们平时编写代码时&#xff0c;经常需要对字符串进行处理&#xff0c;本文详细介绍Python处理字符串常用的30种操作&#xff0c;并给出了对应的代码。 分割 使用split()方法将字符串按照指定的分隔符进行分割。 s "Hello,World" result s.split(","…

国产AI芯片被撕下遮羞布,宁买阉割八成性能的NVIDIA,也不买国产

曾经有传言指有国产AI芯片大受欢迎&#xff0c;还卖出了100万片&#xff0c;不过半年多时间过去&#xff0c;海外分析机构指出国内的互联网企业纷纷抢购NVIDIA阉割八成性能的H20&#xff0c;至于国产AI芯片则不获欢迎。 导致如此结果&#xff0c;在于NVIDIA拥有许多独特的优势&…

什么是voc数据,和coco数据的区别是什么?

Pascal VOC 数据集格式 Pascal VOC 数据集的标注文件使用 XML 格式&#xff0c;每个图像对应一个 XML 文件&#xff0c;文件内容包含图像的元数据信息和目标的标注信息。XML 文件结构如下&#xff1a; <annotation><folder>VOC2007</folder><filename&g…

【工具问题】macOS Ventura 下如何开启NTFS移动硬盘读写?

花了半小时&#xff0c;网上检索了各种解决方案&#xff0c;发现还是下面这种方案可行&#xff0c;mark下方便下次遇到问题能更快速解决&#xff5e; macOS Ventura 下如何开启NTFS移动硬盘读写&#xff1f;

论文略读: LLaMA Pro: Progressive LLaMA with Block Expansion

ACL 2024 人类通常在不损害旧技能的情况下获得新技能 然而&#xff0c;对于大型语言模型&#xff08;LLMs&#xff09;&#xff0c;例如从LLaMA到CodeLLaMA&#xff0c;情况正好相反。深度学习笔记&#xff1a;灾难性遗忘-CSDN博客——>论文提出了一种用于LLMs的新的预训练…

Nettyの源码分析

本篇为Netty系列的最后一篇&#xff0c;按照惯例会简单介绍一些Netty相关核心源码。 1、Netty启动源码分析 代码就使用最初的Netty服务器案例&#xff0c;在bind这一行打上断点&#xff0c;观察启动的全过程&#xff1a; 由于某些方法的调用链过深&#xff0c;节约篇幅&#xf…

昇思MindSpore学习笔记4-03生成式--Diffusion扩散模型

摘要&#xff1a; 记录昇思MindSpore AI框架使用DDPM模型给图像数据正向逐步添加噪声&#xff0c;反向逐步去除噪声的工作原理和实际使用方法、步骤。 一、概念 1. 扩散模型Diffusion Models DDPM(denoising diffusion probabilistic model) &#xff08;无&#xff09;条件…

【嵌入式DIY实例-ESP8266篇】-LCD ST7735显示BMP280传感器数据

LCD ST7735显示BMP280传感器数据 文章目录 LCD ST7735显示BMP280传感器数据1、硬件准备与接线2、代码实现本文介绍如何将 ESP8266 NodeMCU 板 (ESP-12E) 与 Bosch Sensortec 的 BMP280 气压和温度传感器连接。 NodeMCU 微控制器 (ESP8266EX) 从 BMP280 传感器读取温度和压力值,…

普通Java工程如何在代码中引用docker-compose.yml中的environment值

文章目录 一、概述二、常规做法1. 数据库配置分离2. 代码引用配置3. 编写启动类4. 支持打包成可执行包5. 支持可执行包打包成docker镜像6. docker运行 三、存在问题分析四、改进措施1. 包含environment 变量的编排文件2. 修改读取配置文件方式3. 为什么可以这样做 五、运行效果…