之前公司的产品从系统开机到进入桌面要等待7s左右,花费了挺长时间都没缩短成功,查了很久的资料,发现在launcher应用的AndroidManifest的application标签页中添加如下两个属性:
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true"
完整代码:
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme.LAUNCHER">
'''''''''''''
</activity>
'''''''''''''
</application>
添加完之后,现在系统开机到进入桌面的时间几乎为0了。