Add a setting for allowing overlays on Settings app

In the past, we allowed non system overlays on user-debug rom.
Acoording to the user-debug guildline, we should not have differnt
behavior between the user build and user debug rom.

To maintain the consistency between user and user debug rom,
We're creating a new developer setting for allowing non-system overlay on
Settings. By default, we don't allow any non-system app overlays on
Settings app unless user turns it on explictly.

Test: Run robotest. Turn on setting, see the overlays on Settings.
Turn off setting, do not see the overlays on Settings.
Fix: 144989059

Change-Id: I87f00a2eda91de003c6e542e7ec45a066f46fbf7
This commit is contained in:
Tsung-Mao Fang
2020-05-29 20:54:42 +08:00
parent 4432ac9c7e
commit f6841ef548
7 changed files with 241 additions and 10 deletions

View File

@@ -22,7 +22,6 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
import android.app.Activity;
import android.os.Build;
import android.view.Window;
import android.view.WindowManager;
@@ -30,6 +29,8 @@ import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import com.android.settings.development.OverlaySettingsPreferenceController;
/**
* A mixin that adds window flag to prevent non-system overlays showing on top of Settings
@@ -45,7 +46,7 @@ public class HideNonSystemOverlayMixin implements LifecycleObserver {
@VisibleForTesting
boolean isEnabled() {
return !Build.IS_DEBUGGABLE;
return !OverlaySettingsPreferenceController.isOverlaySettingsEnabled(mActivity);
}
@OnLifecycleEvent(ON_START)