界面FallbackHome"/>
FBE中的Home界面FallbackHome
FallbackHome
FallbackHome继承Activity,是安卓系统启动后未解锁时的home界面。
Settings程序AndroidManifest.xml中定义了FallbackHome的intent-filter,可以看到Action:“android.intent.category.HOME”。
<!-- Triggered when user-selected home app isn't encryption aware --><activity android:name=".FallbackHome"android:excludeFromRecents="true"android:label=""android:screenOrientation="nosensor"android:taskAffinity="com.android.settings.FallbackHome"android:theme="@style/FallbackHome"><intent-filter android:priority="-1000"><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.HOME" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
FBE (File-Based Encryption)
安卓7.0后开始支持FBE,安卓10后FBE必须被支持。
FEB定义了两个存储位置供应用程序使用:
- Credential Encrypted (CE) storage, which is the default storage location and only available after the user has unlocked the device.
- Device Encrypted (DE) storage, which is a storage location available both during Direct Boot mode and after the user has unlocked the device.
Direct Boot
因为许多应用程序需要在为解锁的状态下使用,比如闹钟,电话,SystemUI,Settings等,这些程序就需要Direct Boot特性,在AndroidManifest.xml的application标签中添加如下属性以支持Direct Boot。
<applicationandroid:directBootAware="true"android:defaultToDeviceProtectedStorage="true">
defaultToDeviceProtectedStorage仅对system app可用,使其数据存储到Device Encrypted (DE) storage,而不是Credential Encrypted (CE) storage。
directBootAware对所有app都可用,使其所有组件都标记为加密感知。
The
directBootAware
attribute at the application level is shorthand for marking all components in the app as being encryption aware.
The
defaultToDeviceProtectedStorage
attribute redirects the default app storage location to point at DE storage instead of pointing at CE storage.
系统中存在2个接收"android.intent.category.HOME"的Activity,启动时处于加密状态,只能启动支持Direct Boot的FallbackHome,而不是熟悉的Launcher界面,FallbackHome判断用户是否解锁:
if (getSystemService(UserManager.class).isUserUnlocked()) {...getSystemService(PowerManager.class).userActivity(SystemClock.uptimeMillis(), false);finish();
}
如果解锁,通过PowerManagerService.userActivity()重置timeout时间,关闭当前FallbackHome。
更多推荐
FBE中的Home界面FallbackHome
发布评论