Offer the bugreport button in debug mode

Provide the dogfood user easy to report SUW issues
Proposal slide: https://docs.google.com/presentation/d/1ujEP0to_y3YJa2Wpxl5wUfUuR_PeLoxCkAVish3w6yQ/
Design doc: https://docs.google.com/document/d/1DeKZPnY0jHRxUqGC0A79VLwKvXXFpvV0i71RsUZcYgM/

Bug: 235901029
Test: Manual test on phone
Change-Id: Ic2c0ee92ef84546eeedbaa429486f14089722f35
This commit is contained in:
Cyril Lee
2022-06-10 16:47:42 +00:00
parent 51d1c6ec66
commit 2d5f4509c6
2 changed files with 13 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -1038,7 +1039,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
@Override
public boolean showBeforeProvisioning() {
return false;
return Build.isDebuggable() && mGlobalSettings.getInt(
Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0;
}
}

View File

@@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
@@ -480,4 +481,13 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
// hide dialog again
mGlobalActionsDialogLite.showOrHideDialog(true, true, null /* view */);
}
@Test
public void testBugreportAction_whenDebugMode_shouldOfferBugreportButtonBeforeProvisioning() {
doReturn(1).when(mGlobalSettings).getInt(anyString(), anyInt());
GlobalActionsDialogLite.BugReportAction bugReportAction =
mGlobalActionsDialogLite.makeBugReportActionForTesting();
assertThat(bugReportAction.showBeforeProvisioning()).isTrue();
}
}