Improve PIA dim causing UI flash
When triggering intallation from file browser, the PIA will go with
InstallStaging (dim) -> ... -> PackageInstallerActivity (not dim) ->
open ExternalSourcesBlockedDialog (dim), this may make UI looks like
a flash screen. There is another problem here, when entering PIA,
the UI will default shows. If the PIA needs to open a dialog like
unknown external source, there is an user-visible odd animation
transition here.
To improve the problem, we let the InstallStaging without dim. The
alert UI will hide if PIA needs to open a dialog. It will show again
if the PIA needs it.
Bug: 299029375
Test: manual. See go/b299029375_video to see the improved result
Change-Id: I6cb969dc8862c5a36cd95fd578f75479a9078940
diff --git a/packages/PackageInstaller/AndroidManifest.xml b/packages/PackageInstaller/AndroidManifest.xml
index 5bd422b..a16f9f5 100644
--- a/packages/PackageInstaller/AndroidManifest.xml
+++ b/packages/PackageInstaller/AndroidManifest.xml
@@ -70,15 +70,18 @@
</intent-filter>
</activity>
+ <!-- NOTE: the workaround to fix the screen flash problem. Remember to check the problem
+ is resolved for new implementation -->
<activity android:name=".InstallStaging"
- android:exported="false" />
+ android:theme="@style/Theme.AlertDialogActivity.NoDim"
+ android:exported="false" />
<activity android:name=".DeleteStagedFileOnResult"
android:theme="@style/Theme.AlertDialogActivity.NoActionBar"
android:exported="false" />
<activity android:name=".PackageInstallerActivity"
- android:exported="false" />
+ android:exported="false" />
<activity android:name=".InstallInstalling"
android:theme="@style/Theme.AlertDialogActivity.NoAnimation"
diff --git a/packages/PackageInstaller/res/values/themes.xml b/packages/PackageInstaller/res/values/themes.xml
index 9a06229..aa1fa16 100644
--- a/packages/PackageInstaller/res/values/themes.xml
+++ b/packages/PackageInstaller/res/values/themes.xml
@@ -32,4 +32,9 @@
<item name="android:windowNoTitle">true</item>
</style>
+ <style name="Theme.AlertDialogActivity.NoDim">
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:backgroundDimAmount">0</item>
+ </style>
+
</resources>
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
index 80e8761..d97fb54 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -306,6 +306,7 @@
}
private void initiateInstall() {
+ bindUi();
String pkgName = mPkgInfo.packageName;
// Check if there is already a package on the device with this name
// but it has been renamed to something else.
@@ -445,7 +446,6 @@
if (mAppSnippet != null) {
// load placeholder layout with OK button disabled until we override this layout in
// startInstallConfirm
- bindUi();
checkIfAllowedAndInitiateInstall();
}