From b7a6549654374800d3954b4e765c86b5a888258b Mon Sep 17 00:00:00 2001 From: Abhijeet Kaur Date: Thu, 21 Mar 2019 15:42:43 +0000 Subject: Add Looper.prepare() to doInBackground() Fix runtime error that was being thrown as Looper.prepare() was not called in the async function doInBackground. Bug: 124612105 Test: Was not able to reproduce the bug (that is make code execution flow through the catch block). * Reproduced by throwing IOException in the try block so that code flows to the catch block. * Build and flash. * Take interactive bugreport and change title and name of the bugreport from the progress bar. Change-Id: I6a5ea594d95462e1c66bd28eb81dd5f4daa6f35e --- packages/Shell/src/com/android/shell/BugreportProgressService.java | 1 + 1 file changed, 1 insertion(+) (limited to 'packages/Shell/src') diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index a9ff21fef99c..1060c7b7ce79 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -1095,6 +1095,7 @@ public class BugreportProgressService extends Service { new AsyncTask() { @Override protected Void doInBackground(Void... params) { + Looper.prepare(); zipBugreport(info); sendBugreportNotification(info, takingScreenshot); return null; -- cgit v1.2.3-59-g8ed1b From 8549ccf69b7221a75f11d040b7de4a93a700a1ba Mon Sep 17 00:00:00 2001 From: Abhijeet Kaur Date: Wed, 22 May 2019 18:47:49 +0100 Subject: Add dark theme for Shell app. Bugreport info dialog is used in the BugreportProgressService; services are not themeable from the manifest file. Added themed context wrapper in the service file. Text view underlines are no longer black, and are white in color. Bug: 128364209 Test: build and flash to device, manually verified the color of the dialog Change-Id: Ia42c1c7c2b6f2e30d91a5522f1d6b3507b032cdb --- packages/Shell/AndroidManifest.xml | 6 +++--- packages/Shell/src/com/android/shell/BugreportProgressService.java | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'packages/Shell/src') diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index e00f204945c1..d9936d6da25f 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -205,8 +205,9 @@ + android:theme="@android:style/Theme.DeviceDefault.DayNight" + android:defaultToDeviceProtectedStorage="true" + android:directBootAware="true"> diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 1060c7b7ce79..e57a5ded0698 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -99,6 +99,7 @@ import android.util.Log; import android.util.Pair; import android.util.Patterns; import android.util.SparseArray; +import android.view.ContextThemeWrapper; import android.view.IWindowManager; import android.view.View; import android.view.WindowManager; @@ -1467,11 +1468,13 @@ public class BugreportProgressService extends Service { void initialize(final Context context, BugreportInfo info) { final String dialogTitle = context.getString(R.string.bugreport_info_dialog_title, info.id); + final Context themedContext = new ContextThemeWrapper( + context, com.android.internal.R.style.Theme_DeviceDefault_DayNight); // First initializes singleton. if (mDialog == null) { @SuppressLint("InflateParams") // It's ok pass null ViewRoot on AlertDialogs. - final View view = View.inflate(context, R.layout.dialog_bugreport_info, null); + final View view = View.inflate(themedContext, R.layout.dialog_bugreport_info, null); mInfoName = (EditText) view.findViewById(R.id.name); mInfoTitle = (EditText) view.findViewById(R.id.title); @@ -1488,7 +1491,7 @@ public class BugreportProgressService extends Service { } }); - mDialog = new AlertDialog.Builder(context) + mDialog = new AlertDialog.Builder(themedContext) .setView(view) .setTitle(dialogTitle) .setCancelable(true) -- cgit v1.2.3-59-g8ed1b