From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Yiling Chuang Date: Mon, 8 Jul 2024 03:09:50 +0000 Subject: [PATCH] RESTRICT AUTOMERGE FRP bypass defense in App battery usage page Before the setup flow completion, don't allow the app info page in App battery usage to be launched. Bug: 327748846 Test: atest SettingsRoboTests + manual test - factory reset + launch app battery usage app info via ADB during Setup -> verify app closes Flag : EXEMPT bugfix (cherry picked from commit 419a6a907902a12a0f565c808fa70092004d6686) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:62b0014ed6e69b0abc48a5c18b740f95bc5dc429) Merged-In: I486820ca2afecc02729a56a3c531fb931c1907d0 Change-Id: I486820ca2afecc02729a56a3c531fb931c1907d0 --- .../android/settings/fuelgauge/AdvancedPowerUsageDetail.java | 5 +++++ .../settings/fuelgauge/AdvancedPowerUsageDetailTest.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java index 683395e773c..d2a34c64886 100644 --- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java +++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java @@ -234,6 +234,11 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements initPreference(); } + @Override + protected boolean shouldSkipForInitialSUW() { + return true; + } + @VisibleForTesting void initAnomalyInfo() { mAnomalies = getArguments().getParcelableArrayList(EXTRA_ANOMALY_LIST); diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java index 0be63899785..485cfd672bf 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java @@ -435,4 +435,9 @@ public class AdvancedPowerUsageDetailTest { verify(mAnomalySummaryPreferenceController).updateAnomalySummaryPreference(mAnomalies); } + + @Test + public void shouldSkipForInitialSUW_returnTrue() { + assertThat(mFragment.shouldSkipForInitialSUW()).isTrue(); + } }