Merge "Fixing crash when dumping secondary SystemUI user service." into nyc-dev

This commit is contained in:
Winson Chung
2016-04-20 00:21:38 +00:00
committed by Android (Google) Code Review

View File

@@ -16,11 +16,9 @@
package com.android.systemui; package com.android.systemui;
import android.app.ActivityManager;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.IBinder; import android.os.IBinder;
import android.os.Process;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -43,12 +41,15 @@ public class SystemUISecondaryUserService extends Service {
SystemUI[] services = ((SystemUIApplication) getApplication()).getServices(); SystemUI[] services = ((SystemUIApplication) getApplication()).getServices();
if (args == null || args.length == 0) { if (args == null || args.length == 0) {
for (SystemUI ui: services) { for (SystemUI ui: services) {
if (ui != null) {
pw.println("dumping service: " + ui.getClass().getName()); pw.println("dumping service: " + ui.getClass().getName());
ui.dump(fd, pw, args); ui.dump(fd, pw, args);
} }
}
} else { } else {
String svc = args[0]; String svc = args[0];
for (SystemUI ui: services) { for (SystemUI ui: services) {
if (ui != null) {
String name = ui.getClass().getName(); String name = ui.getClass().getName();
if (name.endsWith(svc)) { if (name.endsWith(svc)) {
ui.dump(fd, pw, args); ui.dump(fd, pw, args);
@@ -56,5 +57,6 @@ public class SystemUISecondaryUserService extends Service {
} }
} }
} }
}
} }