Loading packages/Shell/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,7 @@ <!-- Toast message sent when the bugreport file could be read. --> <string name="bugreport_unreadable_text">Bug report file could not be read</string> <!-- Title for bug reports received from dumpstate without a name. [CHAR LIMIT=30]--> <string name="bugreport_unnamed">unnamed</string> </resources> packages/Shell/src/com/android/shell/BugreportProgressService.java +163 −153 Original line number Diff line number Diff line Loading @@ -180,13 +180,13 @@ public class BugreportProgressService extends Service { private final class ServiceHandler extends Handler { public ServiceHandler(Looper looper) { super(looper); pollProgress(); poll(); } @Override public void handleMessage(Message msg) { if (msg.what == MSG_POLL) { pollProgress(); poll(); return; } Loading Loading @@ -243,6 +243,14 @@ public class BugreportProgressService extends Service { } private void poll() { if (pollProgress()) { // Keep polling... sendEmptyMessageDelayed(MSG_POLL, POLLING_FREQUENCY); } } } /** * Creates the {@link BugreportInfo} for a process and issue a system notification to * indicate its progress. Loading @@ -252,7 +260,6 @@ public class BugreportProgressService extends Service { private boolean startProgress(String name, int pid, int max) { if (name == null) { Log.w(TAG, "Missing " + EXTRA_NAME + " on start intent"); name = "N/A"; } if (pid == -1) { Log.e(TAG, "Missing " + EXTRA_PID + " on start intent"); Loading @@ -279,7 +286,7 @@ public class BugreportProgressService extends Service { * Updates the system notification for a given bug report. */ private void updateProgress(BugreportInfo info) { if (info.max <= 0 || info.progress < 0 || info.name == null) { if (info.max <= 0 || info.progress < 0) { Log.e(TAG, "Invalid progress values for " + info); return; } Loading @@ -299,11 +306,14 @@ public class BugreportProgressService extends Service { PendingIntent.FLAG_CANCEL_CURRENT)).build(); final String title = context.getString(R.string.bugreport_in_progress_title); final String name = info.name != null ? info.name : context.getString(R.string.bugreport_unnamed); final Notification notification = new Notification.Builder(context) .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) .setContentTitle(title) .setTicker(title) .setContentText(info.name) .setContentText(name) .setContentInfo(percentText) .setProgress(info.max, info.progress, false) .setOngoing(true) Loading Loading @@ -348,8 +358,10 @@ public class BugreportProgressService extends Service { /** * Poll {@link SystemProperties} to get the progress on each monitored process. * * @return whether it should keep polling. */ private void pollProgress() { private boolean pollProgress() { synchronized (mProcesses) { if (mProcesses.size() == 0) { Log.d(TAG, "No process to poll progress."); Loading Loading @@ -389,8 +401,7 @@ public class BugreportProgressService extends Service { } } } // Keep polling... sendEmptyMessageDelayed(MSG_POLL, POLLING_FREQUENCY); return true; } } Loading Loading @@ -418,7 +429,6 @@ public class BugreportProgressService extends Service { triggerLocalNotification(context, pid, bugreportFile, screenshotFile); } } } /** * Responsible for triggering a notification that allows the user to start a "share" intent with Loading Loading
packages/Shell/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,7 @@ <!-- Toast message sent when the bugreport file could be read. --> <string name="bugreport_unreadable_text">Bug report file could not be read</string> <!-- Title for bug reports received from dumpstate without a name. [CHAR LIMIT=30]--> <string name="bugreport_unnamed">unnamed</string> </resources>
packages/Shell/src/com/android/shell/BugreportProgressService.java +163 −153 Original line number Diff line number Diff line Loading @@ -180,13 +180,13 @@ public class BugreportProgressService extends Service { private final class ServiceHandler extends Handler { public ServiceHandler(Looper looper) { super(looper); pollProgress(); poll(); } @Override public void handleMessage(Message msg) { if (msg.what == MSG_POLL) { pollProgress(); poll(); return; } Loading Loading @@ -243,6 +243,14 @@ public class BugreportProgressService extends Service { } private void poll() { if (pollProgress()) { // Keep polling... sendEmptyMessageDelayed(MSG_POLL, POLLING_FREQUENCY); } } } /** * Creates the {@link BugreportInfo} for a process and issue a system notification to * indicate its progress. Loading @@ -252,7 +260,6 @@ public class BugreportProgressService extends Service { private boolean startProgress(String name, int pid, int max) { if (name == null) { Log.w(TAG, "Missing " + EXTRA_NAME + " on start intent"); name = "N/A"; } if (pid == -1) { Log.e(TAG, "Missing " + EXTRA_PID + " on start intent"); Loading @@ -279,7 +286,7 @@ public class BugreportProgressService extends Service { * Updates the system notification for a given bug report. */ private void updateProgress(BugreportInfo info) { if (info.max <= 0 || info.progress < 0 || info.name == null) { if (info.max <= 0 || info.progress < 0) { Log.e(TAG, "Invalid progress values for " + info); return; } Loading @@ -299,11 +306,14 @@ public class BugreportProgressService extends Service { PendingIntent.FLAG_CANCEL_CURRENT)).build(); final String title = context.getString(R.string.bugreport_in_progress_title); final String name = info.name != null ? info.name : context.getString(R.string.bugreport_unnamed); final Notification notification = new Notification.Builder(context) .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) .setContentTitle(title) .setTicker(title) .setContentText(info.name) .setContentText(name) .setContentInfo(percentText) .setProgress(info.max, info.progress, false) .setOngoing(true) Loading Loading @@ -348,8 +358,10 @@ public class BugreportProgressService extends Service { /** * Poll {@link SystemProperties} to get the progress on each monitored process. * * @return whether it should keep polling. */ private void pollProgress() { private boolean pollProgress() { synchronized (mProcesses) { if (mProcesses.size() == 0) { Log.d(TAG, "No process to poll progress."); Loading Loading @@ -389,8 +401,7 @@ public class BugreportProgressService extends Service { } } } // Keep polling... sendEmptyMessageDelayed(MSG_POLL, POLLING_FREQUENCY); return true; } } Loading Loading @@ -418,7 +429,6 @@ public class BugreportProgressService extends Service { triggerLocalNotification(context, pid, bugreportFile, screenshotFile); } } } /** * Responsible for triggering a notification that allows the user to start a "share" intent with Loading