Loading core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -12542,6 +12542,19 @@ public final class Settings { public static final String LAUNCHER_TASKBAR_EDUCATION_SHOWING = "launcher_taskbar_education_showing"; /** * Whether any Compat UI Education is currently showing. * * <p>1 if true, 0 or unset otherwise. * * <p>This setting is used to inform other components that the Compat UI Education is * currently showing, which can prevent them from showing something else to the user. * * @hide */ public static final String COMPAT_UI_EDUCATION_SHOWING = "compat_ui_education_showing"; /** * Whether or not adaptive charging feature is enabled by user. * Type: int (0 for false, 1 for true) Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIStatusManager.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.compatui; import android.annotation.NonNull; import java.util.function.IntConsumer; import java.util.function.IntSupplier; /** Handle the visibility state of the Compat UI components. */ public class CompatUIStatusManager { public static final int COMPAT_UI_EDUCATION_HIDDEN = 0; public static final int COMPAT_UI_EDUCATION_VISIBLE = 1; @NonNull private final IntConsumer mWriter; @NonNull private final IntSupplier mReader; public CompatUIStatusManager(@NonNull IntConsumer writer, @NonNull IntSupplier reader) { mWriter = writer; mReader = reader; } public CompatUIStatusManager() { this(i -> { }, () -> COMPAT_UI_EDUCATION_HIDDEN); } void onEducationShown() { mWriter.accept(COMPAT_UI_EDUCATION_VISIBLE); } void onEducationHidden() { mWriter.accept(COMPAT_UI_EDUCATION_HIDDEN); } boolean isEducationVisible() { return mReader.getAsInt() == COMPAT_UI_EDUCATION_VISIBLE; } } libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIStatusManagerTest.java 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.compatui; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.function.IntConsumer; import java.util.function.IntSupplier; /** * Tests for {@link CompatUILayout}. * * Build/Install/Run: * atest WMShellUnitTests:CompatUIStatusManagerTest */ @RunWith(AndroidTestingRunner.class) @SmallTest public class CompatUIStatusManagerTest extends ShellTestCase { private FakeCompatUIStatusManagerTest mTestState; private CompatUIStatusManager mStatusManager; @Before public void setUp() { mTestState = new FakeCompatUIStatusManagerTest(); mStatusManager = new CompatUIStatusManager(mTestState.mWriter, mTestState.mReader); } @Test public void isEducationShown() { assertFalse(mStatusManager.isEducationVisible()); mStatusManager.onEducationShown(); assertTrue(mStatusManager.isEducationVisible()); mStatusManager.onEducationHidden(); assertFalse(mStatusManager.isEducationVisible()); } static class FakeCompatUIStatusManagerTest { int mCurrentStatus = 0; final IntSupplier mReader = () -> mCurrentStatus; final IntConsumer mWriter = newStatus -> mCurrentStatus = newStatus; } } packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -677,6 +677,7 @@ public class SettingsBackupTest { Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup? Settings.Secure.CARRIER_APPS_HANDLED, Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG, Settings.Secure.COMPAT_UI_EDUCATION_SHOWING, Settings.Secure.COMPLETED_CATEGORY_PREFIX, Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS, Settings.Secure.CONTENT_CAPTURE_ENABLED, Loading Loading
core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -12542,6 +12542,19 @@ public final class Settings { public static final String LAUNCHER_TASKBAR_EDUCATION_SHOWING = "launcher_taskbar_education_showing"; /** * Whether any Compat UI Education is currently showing. * * <p>1 if true, 0 or unset otherwise. * * <p>This setting is used to inform other components that the Compat UI Education is * currently showing, which can prevent them from showing something else to the user. * * @hide */ public static final String COMPAT_UI_EDUCATION_SHOWING = "compat_ui_education_showing"; /** * Whether or not adaptive charging feature is enabled by user. * Type: int (0 for false, 1 for true) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIStatusManager.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.compatui; import android.annotation.NonNull; import java.util.function.IntConsumer; import java.util.function.IntSupplier; /** Handle the visibility state of the Compat UI components. */ public class CompatUIStatusManager { public static final int COMPAT_UI_EDUCATION_HIDDEN = 0; public static final int COMPAT_UI_EDUCATION_VISIBLE = 1; @NonNull private final IntConsumer mWriter; @NonNull private final IntSupplier mReader; public CompatUIStatusManager(@NonNull IntConsumer writer, @NonNull IntSupplier reader) { mWriter = writer; mReader = reader; } public CompatUIStatusManager() { this(i -> { }, () -> COMPAT_UI_EDUCATION_HIDDEN); } void onEducationShown() { mWriter.accept(COMPAT_UI_EDUCATION_VISIBLE); } void onEducationHidden() { mWriter.accept(COMPAT_UI_EDUCATION_HIDDEN); } boolean isEducationVisible() { return mReader.getAsInt() == COMPAT_UI_EDUCATION_VISIBLE; } }
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIStatusManagerTest.java 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.compatui; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.wm.shell.ShellTestCase; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.function.IntConsumer; import java.util.function.IntSupplier; /** * Tests for {@link CompatUILayout}. * * Build/Install/Run: * atest WMShellUnitTests:CompatUIStatusManagerTest */ @RunWith(AndroidTestingRunner.class) @SmallTest public class CompatUIStatusManagerTest extends ShellTestCase { private FakeCompatUIStatusManagerTest mTestState; private CompatUIStatusManager mStatusManager; @Before public void setUp() { mTestState = new FakeCompatUIStatusManagerTest(); mStatusManager = new CompatUIStatusManager(mTestState.mWriter, mTestState.mReader); } @Test public void isEducationShown() { assertFalse(mStatusManager.isEducationVisible()); mStatusManager.onEducationShown(); assertTrue(mStatusManager.isEducationVisible()); mStatusManager.onEducationHidden(); assertFalse(mStatusManager.isEducationVisible()); } static class FakeCompatUIStatusManagerTest { int mCurrentStatus = 0; final IntSupplier mReader = () -> mCurrentStatus; final IntConsumer mWriter = newStatus -> mCurrentStatus = newStatus; } }
packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -677,6 +677,7 @@ public class SettingsBackupTest { Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup? Settings.Secure.CARRIER_APPS_HANDLED, Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG, Settings.Secure.COMPAT_UI_EDUCATION_SHOWING, Settings.Secure.COMPLETED_CATEGORY_PREFIX, Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS, Settings.Secure.CONTENT_CAPTURE_ENABLED, Loading