Loading api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -1635,7 +1635,7 @@ package android.content.pm { method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle); method public abstract void registerDexModule(@NonNull String, @Nullable android.content.pm.PackageManager.DexModuleRegisterCallback); method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void removeOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener); method @Deprecated public void replacePreferredActivity(@NonNull android.content.IntentFilter, int, @NonNull java.util.List<android.content.ComponentName>, @NonNull android.content.ComponentName); method public void replacePreferredActivity(@NonNull android.content.IntentFilter, int, @NonNull java.util.List<android.content.ComponentName>, @NonNull android.content.ComponentName); method @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) public abstract void revokeRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle); method public void sendDeviceCustomizationReadyBroadcast(); method @RequiresPermission(allOf={android.Manifest.permission.SET_PREFERRED_APPLICATIONS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract boolean setDefaultBrowserPackageNameAsUser(@Nullable String, int); Loading api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3205,6 +3205,7 @@ package android.view { method public default void setShouldShowIme(int, boolean); method public default void setShouldShowSystemDecors(int, boolean); method public default void setShouldShowWithInsecureKeyguard(int, boolean); method public default boolean shouldShowIme(int); method public default boolean shouldShowSystemDecors(int); } Loading cmds/am/proto/instrumentation_data.proto +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ message ResultsBundle { message TestStatus { optional sint32 result_code = 3; optional ResultsBundle results = 4; optional string logcat = 5; } enum SessionStatusCode { Loading cmds/am/src/com/android/commands/am/Instrument.java +66 −6 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.view.IWindowManager; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; Loading @@ -62,8 +63,15 @@ import java.util.Locale; * other: Failure */ public class Instrument { private static final String TAG = "am"; public static final String DEFAULT_LOG_DIR = "instrument-logs"; private static final int STATUS_TEST_PASSED = 0; private static final int STATUS_TEST_STARTED = 1; private static final int STATUS_TEST_FAILED_ASSERTION = -1; private static final int STATUS_TEST_FAILED_OTHER = -2; private final IActivityManager mAm; private final IPackageManager mPm; private final IWindowManager mWm; Loading Loading @@ -207,6 +215,8 @@ public class Instrument { private File mLog; private long mTestStartMs; ProtoStatusReporter() { if (protoFile) { if (logPath == null) { Loading Loading @@ -241,10 +251,22 @@ public class Instrument { Bundle results) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.TEST_STATUS); final long testStatusToken = proto.start(InstrumentationData.Session.TEST_STATUS); proto.write(InstrumentationData.TestStatus.RESULT_CODE, resultCode); writeBundle(proto, InstrumentationData.TestStatus.RESULTS, results); proto.end(token); if (resultCode == STATUS_TEST_STARTED) { // Logcat -T takes wall clock time (!?) mTestStartMs = System.currentTimeMillis(); } else { if (mTestStartMs > 0) { proto.write(InstrumentationData.TestStatus.LOGCAT, readLogcat(mTestStartMs)); } mTestStartMs = 0; } proto.end(testStatusToken); outputProto(proto); } Loading @@ -254,12 +276,12 @@ public class Instrument { Bundle results) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.SESSION_STATUS); final long sessionStatusToken = proto.start(InstrumentationData.Session.SESSION_STATUS); proto.write(InstrumentationData.SessionStatus.STATUS_CODE, InstrumentationData.SESSION_FINISHED); proto.write(InstrumentationData.SessionStatus.RESULT_CODE, resultCode); writeBundle(proto, InstrumentationData.SessionStatus.RESULTS, results); proto.end(token); proto.end(sessionStatusToken); outputProto(proto); } Loading @@ -268,11 +290,11 @@ public class Instrument { public void onError(String errorText, boolean commandError) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.SESSION_STATUS); final long sessionStatusToken = proto.start(InstrumentationData.Session.SESSION_STATUS); proto.write(InstrumentationData.SessionStatus.STATUS_CODE, InstrumentationData.SESSION_ABORTED); proto.write(InstrumentationData.SessionStatus.ERROR_TEXT, errorText); proto.end(token); proto.end(sessionStatusToken); outputProto(proto); } Loading Loading @@ -514,5 +536,43 @@ public class Instrument { } } } private static String readLogcat(long startTimeMs) { try { // Figure out the timestamp arg for logcat. final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); final String timestamp = format.format(new Date(startTimeMs)); // Start the process final Process process = new ProcessBuilder() .command("logcat", "-d", "-v threadtime,uid", "-T", timestamp) .start(); // Nothing to write. Don't let the command accidentally block. process.getOutputStream().close(); // Read the output final StringBuilder str = new StringBuilder(); final InputStreamReader reader = new InputStreamReader(process.getInputStream()); char[] buffer = new char[4096]; int amt; while ((amt = reader.read(buffer, 0, buffer.length)) >= 0) { if (amt > 0) { str.append(buffer, 0, amt); } } try { process.waitFor(); } catch (InterruptedException ex) { // We already have the text, drop the exception. } return str.toString(); } catch (IOException ex) { return "Error reading logcat command:\n" + ex.toString(); } } } cmds/incidentd/OWNERS +2 −1 Original line number Diff line number Diff line joeo@google.com kwekua@google.com yaochen@google.com yanmin@google.com zhouwenjie@google.com Loading
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -1635,7 +1635,7 @@ package android.content.pm { method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle); method public abstract void registerDexModule(@NonNull String, @Nullable android.content.pm.PackageManager.DexModuleRegisterCallback); method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void removeOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener); method @Deprecated public void replacePreferredActivity(@NonNull android.content.IntentFilter, int, @NonNull java.util.List<android.content.ComponentName>, @NonNull android.content.ComponentName); method public void replacePreferredActivity(@NonNull android.content.IntentFilter, int, @NonNull java.util.List<android.content.ComponentName>, @NonNull android.content.ComponentName); method @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) public abstract void revokeRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle); method public void sendDeviceCustomizationReadyBroadcast(); method @RequiresPermission(allOf={android.Manifest.permission.SET_PREFERRED_APPLICATIONS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract boolean setDefaultBrowserPackageNameAsUser(@Nullable String, int); Loading
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3205,6 +3205,7 @@ package android.view { method public default void setShouldShowIme(int, boolean); method public default void setShouldShowSystemDecors(int, boolean); method public default void setShouldShowWithInsecureKeyguard(int, boolean); method public default boolean shouldShowIme(int); method public default boolean shouldShowSystemDecors(int); } Loading
cmds/am/proto/instrumentation_data.proto +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ message ResultsBundle { message TestStatus { optional sint32 result_code = 3; optional ResultsBundle results = 4; optional string logcat = 5; } enum SessionStatusCode { Loading
cmds/am/src/com/android/commands/am/Instrument.java +66 −6 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.view.IWindowManager; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; Loading @@ -62,8 +63,15 @@ import java.util.Locale; * other: Failure */ public class Instrument { private static final String TAG = "am"; public static final String DEFAULT_LOG_DIR = "instrument-logs"; private static final int STATUS_TEST_PASSED = 0; private static final int STATUS_TEST_STARTED = 1; private static final int STATUS_TEST_FAILED_ASSERTION = -1; private static final int STATUS_TEST_FAILED_OTHER = -2; private final IActivityManager mAm; private final IPackageManager mPm; private final IWindowManager mWm; Loading Loading @@ -207,6 +215,8 @@ public class Instrument { private File mLog; private long mTestStartMs; ProtoStatusReporter() { if (protoFile) { if (logPath == null) { Loading Loading @@ -241,10 +251,22 @@ public class Instrument { Bundle results) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.TEST_STATUS); final long testStatusToken = proto.start(InstrumentationData.Session.TEST_STATUS); proto.write(InstrumentationData.TestStatus.RESULT_CODE, resultCode); writeBundle(proto, InstrumentationData.TestStatus.RESULTS, results); proto.end(token); if (resultCode == STATUS_TEST_STARTED) { // Logcat -T takes wall clock time (!?) mTestStartMs = System.currentTimeMillis(); } else { if (mTestStartMs > 0) { proto.write(InstrumentationData.TestStatus.LOGCAT, readLogcat(mTestStartMs)); } mTestStartMs = 0; } proto.end(testStatusToken); outputProto(proto); } Loading @@ -254,12 +276,12 @@ public class Instrument { Bundle results) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.SESSION_STATUS); final long sessionStatusToken = proto.start(InstrumentationData.Session.SESSION_STATUS); proto.write(InstrumentationData.SessionStatus.STATUS_CODE, InstrumentationData.SESSION_FINISHED); proto.write(InstrumentationData.SessionStatus.RESULT_CODE, resultCode); writeBundle(proto, InstrumentationData.SessionStatus.RESULTS, results); proto.end(token); proto.end(sessionStatusToken); outputProto(proto); } Loading @@ -268,11 +290,11 @@ public class Instrument { public void onError(String errorText, boolean commandError) { final ProtoOutputStream proto = new ProtoOutputStream(); final long token = proto.start(InstrumentationData.Session.SESSION_STATUS); final long sessionStatusToken = proto.start(InstrumentationData.Session.SESSION_STATUS); proto.write(InstrumentationData.SessionStatus.STATUS_CODE, InstrumentationData.SESSION_ABORTED); proto.write(InstrumentationData.SessionStatus.ERROR_TEXT, errorText); proto.end(token); proto.end(sessionStatusToken); outputProto(proto); } Loading Loading @@ -514,5 +536,43 @@ public class Instrument { } } } private static String readLogcat(long startTimeMs) { try { // Figure out the timestamp arg for logcat. final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); final String timestamp = format.format(new Date(startTimeMs)); // Start the process final Process process = new ProcessBuilder() .command("logcat", "-d", "-v threadtime,uid", "-T", timestamp) .start(); // Nothing to write. Don't let the command accidentally block. process.getOutputStream().close(); // Read the output final StringBuilder str = new StringBuilder(); final InputStreamReader reader = new InputStreamReader(process.getInputStream()); char[] buffer = new char[4096]; int amt; while ((amt = reader.read(buffer, 0, buffer.length)) >= 0) { if (amt > 0) { str.append(buffer, 0, amt); } } try { process.waitFor(); } catch (InterruptedException ex) { // We already have the text, drop the exception. } return str.toString(); } catch (IOException ex) { return "Error reading logcat command:\n" + ex.toString(); } } }
cmds/incidentd/OWNERS +2 −1 Original line number Diff line number Diff line joeo@google.com kwekua@google.com yaochen@google.com yanmin@google.com zhouwenjie@google.com