Loading cmds/incidentd/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -54,9 +54,7 @@ LOCAL_SHARED_LIBRARIES := \ libservices \ libutils ifeq (BUILD_WITH_INCIDENTD_RC,true) LOCAL_INIT_RC := incidentd.rc endif include $(BUILD_EXECUTABLE) Loading cmds/incidentd/src/Reporter.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -225,9 +225,8 @@ Reporter::runReport() // and report to those that care that we're doing it. for (const Section** section=SECTION_LIST; *section; section++) { const int id = (*section)->id; ALOGD("Taking incident report section %d '%s'", id, (*section)->name.string()); if (this->batch.containsSection(id)) { ALOGD("Taking incident report section %d '%s'", id, (*section)->name.string()); // Notify listener of starting for (ReportRequestSet::iterator it=batch.begin(); it!=batch.end(); it++) { if ((*it)->listener != NULL && (*it)->args.containsSection(id)) { Loading @@ -251,6 +250,7 @@ Reporter::runReport() IIncidentReportStatusListener::STATUS_FINISHED); } } ALOGD("Finish incident report section %d '%s'", id, (*section)->name.string()); } } Loading Loading @@ -324,6 +324,7 @@ Reporter::upload_backlog() struct stat st; status_t err; ALOGD("Start uploading backlogs in %s", INCIDENT_DIRECTORY); if ((err = create_directory(INCIDENT_DIRECTORY)) != NO_ERROR) { ALOGE("directory doesn't exist: %s", strerror(-err)); return REPORT_FINISHED; Loading @@ -337,6 +338,7 @@ Reporter::upload_backlog() sp<DropBoxManager> dropbox = new DropBoxManager(); // Enumerate, count and add up size int count = 0; while ((entry = readdir(dir)) != NULL) { if (entry->d_name[0] == '.') { continue; Loading @@ -360,8 +362,9 @@ Reporter::upload_backlog() // boot or the next checkin. If the directory gets too big older files will // be rotated out. unlink(filename.string()); count++; } ALOGD("Successfully uploaded %d files to Dropbox.", count); closedir(dir); return REPORT_FINISHED; Loading core/java/android/os/IncidentManager.java +11 −22 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; import android.os.IIncidentManager; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; Loading @@ -37,7 +35,7 @@ import android.util.Slog; public class IncidentManager { private static final String TAG = "incident"; private Context mContext; private final Context mContext; /** * @hide Loading @@ -54,18 +52,7 @@ public class IncidentManager { android.Manifest.permission.PACKAGE_USAGE_STATS }) public void reportIncident(IncidentReportArgs args) { final IIncidentManager service = IIncidentManager.Stub.asInterface( ServiceManager.getService("incident")); if (service == null) { Slog.e(TAG, "reportIncident can't find incident binder service"); return; } try { service.reportIncident(args); } catch (RemoteException ex) { Slog.e(TAG, "reportIncident failed", ex); } reportIncidentInternal(args); } /** Loading @@ -89,7 +76,7 @@ public class IncidentManager { }) public void reportIncident(String settingName, byte[] headerProto) { // Sections String setting = Settings.System.getString(mContext.getContentResolver(), settingName); String setting = Settings.Global.getString(mContext.getContentResolver(), settingName); IncidentReportArgs args; try { args = IncidentReportArgs.parseSetting(setting); Loading @@ -98,23 +85,25 @@ public class IncidentManager { return; } if (args == null) { Slog.i(TAG, "Incident report requested but disabled: " + settingName); Slog.i(TAG, String.format("Incident report requested but disabled with " + "settings [name: %s, value: %s]", settingName, setting)); return; } // Header args.addHeader(headerProto); // Look up the service Slog.i(TAG, "Taking incident report: " + settingName); reportIncidentInternal(args); } private void reportIncidentInternal(IncidentReportArgs args) { final IIncidentManager service = IIncidentManager.Stub.asInterface( ServiceManager.getService("incident")); ServiceManager.getService(Context.INCIDENT_SERVICE)); if (service == null) { Slog.e(TAG, "reportIncident can't find incident binder service"); return; } // Call the service Slog.i(TAG, "Taking incident report: " + settingName); try { service.reportIncident(args); } catch (RemoteException ex) { Loading core/java/android/os/IncidentReportArgs.java +6 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.os; import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; import android.util.IntArray; Loading Loading @@ -50,10 +49,12 @@ public final class IncidentReportArgs implements Parcelable { readFromParcel(in); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(mAll ? 1 : 0); Loading Loading @@ -100,6 +101,7 @@ public final class IncidentReportArgs implements Parcelable { /** * Print this report as a string. */ @Override public String toString() { final StringBuilder sb = new StringBuilder("Incident("); if (mAll) { Loading Loading @@ -131,10 +133,11 @@ public final class IncidentReportArgs implements Parcelable { } /** * Add this section to the incident report. * Add this section to the incident report. Skip if the input is smaller than 2 since section * id are only valid for positive integer as Protobuf field id. Here 1 is reserved for Header. */ public void addSection(int section) { if (!mAll) { if (!mAll && section > 1) { mSections.add(section); } } Loading services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -1842,7 +1842,7 @@ public final class SystemServer { // TODO: Switch from checkService to getService once it's always // in the build and should reliably be there. final IIncidentManager incident = IIncidentManager.Stub.asInterface( ServiceManager.checkService("incident")); ServiceManager.getService(Context.INCIDENT_SERVICE)); if (incident != null) incident.systemRunning(); } catch (Throwable e) { reportWtf("Notifying incident daemon running", e); Loading Loading
cmds/incidentd/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -54,9 +54,7 @@ LOCAL_SHARED_LIBRARIES := \ libservices \ libutils ifeq (BUILD_WITH_INCIDENTD_RC,true) LOCAL_INIT_RC := incidentd.rc endif include $(BUILD_EXECUTABLE) Loading
cmds/incidentd/src/Reporter.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -225,9 +225,8 @@ Reporter::runReport() // and report to those that care that we're doing it. for (const Section** section=SECTION_LIST; *section; section++) { const int id = (*section)->id; ALOGD("Taking incident report section %d '%s'", id, (*section)->name.string()); if (this->batch.containsSection(id)) { ALOGD("Taking incident report section %d '%s'", id, (*section)->name.string()); // Notify listener of starting for (ReportRequestSet::iterator it=batch.begin(); it!=batch.end(); it++) { if ((*it)->listener != NULL && (*it)->args.containsSection(id)) { Loading @@ -251,6 +250,7 @@ Reporter::runReport() IIncidentReportStatusListener::STATUS_FINISHED); } } ALOGD("Finish incident report section %d '%s'", id, (*section)->name.string()); } } Loading Loading @@ -324,6 +324,7 @@ Reporter::upload_backlog() struct stat st; status_t err; ALOGD("Start uploading backlogs in %s", INCIDENT_DIRECTORY); if ((err = create_directory(INCIDENT_DIRECTORY)) != NO_ERROR) { ALOGE("directory doesn't exist: %s", strerror(-err)); return REPORT_FINISHED; Loading @@ -337,6 +338,7 @@ Reporter::upload_backlog() sp<DropBoxManager> dropbox = new DropBoxManager(); // Enumerate, count and add up size int count = 0; while ((entry = readdir(dir)) != NULL) { if (entry->d_name[0] == '.') { continue; Loading @@ -360,8 +362,9 @@ Reporter::upload_backlog() // boot or the next checkin. If the directory gets too big older files will // be rotated out. unlink(filename.string()); count++; } ALOGD("Successfully uploaded %d files to Dropbox.", count); closedir(dir); return REPORT_FINISHED; Loading
core/java/android/os/IncidentManager.java +11 −22 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; import android.os.IIncidentManager; import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; Loading @@ -37,7 +35,7 @@ import android.util.Slog; public class IncidentManager { private static final String TAG = "incident"; private Context mContext; private final Context mContext; /** * @hide Loading @@ -54,18 +52,7 @@ public class IncidentManager { android.Manifest.permission.PACKAGE_USAGE_STATS }) public void reportIncident(IncidentReportArgs args) { final IIncidentManager service = IIncidentManager.Stub.asInterface( ServiceManager.getService("incident")); if (service == null) { Slog.e(TAG, "reportIncident can't find incident binder service"); return; } try { service.reportIncident(args); } catch (RemoteException ex) { Slog.e(TAG, "reportIncident failed", ex); } reportIncidentInternal(args); } /** Loading @@ -89,7 +76,7 @@ public class IncidentManager { }) public void reportIncident(String settingName, byte[] headerProto) { // Sections String setting = Settings.System.getString(mContext.getContentResolver(), settingName); String setting = Settings.Global.getString(mContext.getContentResolver(), settingName); IncidentReportArgs args; try { args = IncidentReportArgs.parseSetting(setting); Loading @@ -98,23 +85,25 @@ public class IncidentManager { return; } if (args == null) { Slog.i(TAG, "Incident report requested but disabled: " + settingName); Slog.i(TAG, String.format("Incident report requested but disabled with " + "settings [name: %s, value: %s]", settingName, setting)); return; } // Header args.addHeader(headerProto); // Look up the service Slog.i(TAG, "Taking incident report: " + settingName); reportIncidentInternal(args); } private void reportIncidentInternal(IncidentReportArgs args) { final IIncidentManager service = IIncidentManager.Stub.asInterface( ServiceManager.getService("incident")); ServiceManager.getService(Context.INCIDENT_SERVICE)); if (service == null) { Slog.e(TAG, "reportIncident can't find incident binder service"); return; } // Call the service Slog.i(TAG, "Taking incident report: " + settingName); try { service.reportIncident(args); } catch (RemoteException ex) { Loading
core/java/android/os/IncidentReportArgs.java +6 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.os; import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; import android.util.IntArray; Loading Loading @@ -50,10 +49,12 @@ public final class IncidentReportArgs implements Parcelable { readFromParcel(in); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(mAll ? 1 : 0); Loading Loading @@ -100,6 +101,7 @@ public final class IncidentReportArgs implements Parcelable { /** * Print this report as a string. */ @Override public String toString() { final StringBuilder sb = new StringBuilder("Incident("); if (mAll) { Loading Loading @@ -131,10 +133,11 @@ public final class IncidentReportArgs implements Parcelable { } /** * Add this section to the incident report. * Add this section to the incident report. Skip if the input is smaller than 2 since section * id are only valid for positive integer as Protobuf field id. Here 1 is reserved for Header. */ public void addSection(int section) { if (!mAll) { if (!mAll && section > 1) { mSections.add(section); } } Loading
services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -1842,7 +1842,7 @@ public final class SystemServer { // TODO: Switch from checkService to getService once it's always // in the build and should reliably be there. final IIncidentManager incident = IIncidentManager.Stub.asInterface( ServiceManager.checkService("incident")); ServiceManager.getService(Context.INCIDENT_SERVICE)); if (incident != null) incident.systemRunning(); } catch (Throwable e) { reportWtf("Notifying incident daemon running", e); Loading