Merge "For teamfooders, do not collapse the shade when collecting a bugreport from global actions." into tm-qpr-dev

This commit is contained in:
Jeff DeCew
2022-10-20 20:08:39 +00:00
committed by Android (Google) Code Review
5 changed files with 84 additions and 9 deletions

View File

@@ -363,6 +363,10 @@ public class Flags {
// 1700 - clipboard
public static final UnreleasedFlag CLIPBOARD_OVERLAY_REFACTOR = new UnreleasedFlag(1700);
// 1800 - shade container
public static final UnreleasedFlag LEAVE_SHADE_OPEN_FOR_BUGREPORT =
new UnreleasedFlag(1800, true);
// Pay no attention to the reflection behind the curtain.
// ========================== Curtain ==========================
// | |

View File

@@ -1016,8 +1016,9 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
Log.w(TAG, "Bugreport handler could not be launched");
mIActivityManager.requestInteractiveBugReport();
}
// Close shade so user sees the activity
mCentralSurfacesOptional.ifPresent(CentralSurfaces::collapseShade);
// Maybe close shade (depends on a flag) so user sees the activity
mCentralSurfacesOptional.ifPresent(
CentralSurfaces::collapseShadeForBugreport);
} catch (RemoteException e) {
}
}
@@ -1036,8 +1037,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mMetricsLogger.action(MetricsEvent.ACTION_BUGREPORT_FROM_POWER_MENU_FULL);
mUiEventLogger.log(GlobalActionsEvent.GA_BUGREPORT_LONG_PRESS);
mIActivityManager.requestFullBugReport();
// Close shade so user sees the activity
mCentralSurfacesOptional.ifPresent(CentralSurfaces::collapseShade);
// Maybe close shade (depends on a flag) so user sees the activity
mCentralSurfacesOptional.ifPresent(CentralSurfaces::collapseShadeForBugreport);
} catch (RemoteException e) {
}
return false;

View File

@@ -455,6 +455,9 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void collapseShade();
/** Collapse the shade, but conditional on a flag specific to the trigger of a bugreport. */
void collapseShadeForBugreport();
int getWakefulnessState();
boolean isScreenFullyOff();

View File

@@ -885,6 +885,11 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mBubblesOptional.get().setExpandListener(mBubbleExpandListener);
}
// Do not restart System UI when the bugreport flag changes.
mFeatureFlags.addListener(Flags.LEAVE_SHADE_OPEN_FOR_BUGREPORT, event -> {
event.requestNoRestart();
});
mStatusBarSignalPolicy.init();
mKeyguardIndicationController.init();
@@ -3580,6 +3585,13 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
}
}
@Override
public void collapseShadeForBugreport() {
if (!mFeatureFlags.isEnabled(Flags.LEAVE_SHADE_OPEN_FOR_BUGREPORT)) {
collapseShade();
}
}
@VisibleForTesting
final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() {
@Override

View File

@@ -98,7 +98,8 @@ import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.FakeFeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.keyguard.KeyguardViewMediator;
@@ -271,7 +272,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Mock private OngoingCallController mOngoingCallController;
@Mock private StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager;
@Mock private LockscreenShadeTransitionController mLockscreenTransitionController;
@Mock private FeatureFlags mFeatureFlags;
@Mock private NotificationVisibilityProvider mVisibilityProvider;
@Mock private WallpaperManager mWallpaperManager;
@Mock private IWallpaperManager mIWallpaperManager;
@@ -296,9 +296,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
private ShadeController mShadeController;
private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
private FakeExecutor mMainExecutor = new FakeExecutor(mFakeSystemClock);
private FakeExecutor mUiBgExecutor = new FakeExecutor(mFakeSystemClock);
private InitController mInitController = new InitController();
private final FakeExecutor mMainExecutor = new FakeExecutor(mFakeSystemClock);
private final FakeExecutor mUiBgExecutor = new FakeExecutor(mFakeSystemClock);
private final FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags();
private final InitController mInitController = new InitController();
private final DumpManager mDumpManager = new DumpManager();
@Before
@@ -1016,6 +1017,60 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
verify(mStatusBarKeyguardViewManager).updateResources();
}
@Test
public void collapseShade_callsAnimateCollapsePanels_whenExpanded() {
// GIVEN the shade is expanded
mCentralSurfaces.setPanelExpanded(true);
mCentralSurfaces.setBarStateForTest(StatusBarState.SHADE);
// WHEN collapseShade is called
mCentralSurfaces.collapseShade();
// VERIFY that animateCollapsePanels is called
verify(mShadeController).animateCollapsePanels();
}
@Test
public void collapseShade_doesNotCallAnimateCollapsePanels_whenCollapsed() {
// GIVEN the shade is collapsed
mCentralSurfaces.setPanelExpanded(false);
mCentralSurfaces.setBarStateForTest(StatusBarState.SHADE);
// WHEN collapseShade is called
mCentralSurfaces.collapseShade();
// VERIFY that animateCollapsePanels is NOT called
verify(mShadeController, never()).animateCollapsePanels();
}
@Test
public void collapseShadeForBugReport_callsAnimateCollapsePanels_whenFlagDisabled() {
// GIVEN the shade is expanded & flag enabled
mCentralSurfaces.setPanelExpanded(true);
mCentralSurfaces.setBarStateForTest(StatusBarState.SHADE);
mFeatureFlags.set(Flags.LEAVE_SHADE_OPEN_FOR_BUGREPORT, false);
// WHEN collapseShadeForBugreport is called
mCentralSurfaces.collapseShadeForBugreport();
// VERIFY that animateCollapsePanels is called
verify(mShadeController).animateCollapsePanels();
}
@Test
public void collapseShadeForBugReport_doesNotCallAnimateCollapsePanels_whenFlagEnabled() {
// GIVEN the shade is expanded & flag enabled
mCentralSurfaces.setPanelExpanded(true);
mCentralSurfaces.setBarStateForTest(StatusBarState.SHADE);
mFeatureFlags.set(Flags.LEAVE_SHADE_OPEN_FOR_BUGREPORT, true);
// WHEN collapseShadeForBugreport is called
mCentralSurfaces.collapseShadeForBugreport();
// VERIFY that animateCollapsePanels is called
verify(mShadeController, never()).animateCollapsePanels();
}
@Test
public void deviceStateChange_unfolded_shadeOpen_setsLeaveOpenOnKeyguardHide() {
when(mKeyguardStateController.isShowing()).thenReturn(false);