Loading TEST_MAPPING +8 −2 Original line number Diff line number Diff line Loading @@ -140,11 +140,17 @@ "ravenwood-presubmit": [ { "name": "CtsUtilTestCasesRavenwood", "host": true "host": true, "file_patterns": [ "[Rr]avenwood" ] }, { "name": "RavenwoodBivalentTest", "host": true "host": true, "file_patterns": [ "[Rr]avenwood" ] } ], "postsubmit-managedprofile-stress": [ Loading core/api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -9875,6 +9875,7 @@ package android.companion { field public static final int RESULT_DISCOVERY_TIMEOUT = 2; // 0x2 field public static final int RESULT_INTERNAL_ERROR = 3; // 0x3 field public static final int RESULT_OK = -1; // 0xffffffff field @FlaggedApi("android.companion.association_failure_code") public static final int RESULT_SECURITY_ERROR = 4; // 0x4 field public static final int RESULT_USER_REJECTED = 1; // 0x1 } Loading @@ -9884,7 +9885,7 @@ package android.companion { method public void onAssociationPending(@NonNull android.content.IntentSender); method @Deprecated public void onDeviceFound(@NonNull android.content.IntentSender); method public abstract void onFailure(@Nullable CharSequence); method @FlaggedApi("android.companion.association_failure_code") public void onFailure(int); method @FlaggedApi("android.companion.association_failure_code") public void onFailure(int, @Nullable CharSequence); } public abstract class CompanionDeviceService extends android.app.Service { core/java/android/app/ApplicationStartInfo.java +30 −4 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ public final class ApplicationStartInfo implements Parcelable { /** Clock monotonic timestamp of surfaceflinger composition complete. */ public static final int START_TIMESTAMP_SURFACEFLINGER_COMPOSITION_COMPLETE = 7; /** * @see #getMonoticCreationTimeMs */ private long mMonoticCreationTimeMs; /** * @see #getStartupState */ Loading Loading @@ -486,6 +491,15 @@ public final class ApplicationStartInfo implements Parcelable { return mStartupState; } /** * Monotonic elapsed time persisted across reboots. * * @hide */ public long getMonoticCreationTimeMs() { return mMonoticCreationTimeMs; } /** * The process id. * Loading Loading @@ -669,7 +683,9 @@ public final class ApplicationStartInfo implements Parcelable { } /** @hide */ public ApplicationStartInfo() {} public ApplicationStartInfo(long monotonicCreationTimeMs) { mMonoticCreationTimeMs = monotonicCreationTimeMs; } /** @hide */ public ApplicationStartInfo(ApplicationStartInfo other) { Loading @@ -686,6 +702,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartIntent = other.mStartIntent; mLaunchMode = other.mLaunchMode; mWasForceStopped = other.mWasForceStopped; mMonoticCreationTimeMs = other.mMonoticCreationTimeMs; } private ApplicationStartInfo(@NonNull Parcel in) { Loading @@ -708,6 +725,7 @@ public final class ApplicationStartInfo implements Parcelable { in.readParcelable(Intent.class.getClassLoader(), android.content.Intent.class); mLaunchMode = in.readInt(); mWasForceStopped = in.readBoolean(); mMonoticCreationTimeMs = in.readLong(); } private static String intern(@Nullable String source) { Loading Loading @@ -786,6 +804,7 @@ public final class ApplicationStartInfo implements Parcelable { } proto.write(ApplicationStartInfoProto.LAUNCH_MODE, mLaunchMode); proto.write(ApplicationStartInfoProto.WAS_FORCE_STOPPED, mWasForceStopped); proto.write(ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS, mMonoticCreationTimeMs); proto.end(token); } Loading Loading @@ -869,6 +888,10 @@ public final class ApplicationStartInfo implements Parcelable { mWasForceStopped = proto.readBoolean( ApplicationStartInfoProto.WAS_FORCE_STOPPED); break; case (int) ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS: mMonoticCreationTimeMs = proto.readLong( ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS); break; } } proto.end(token); Loading @@ -881,6 +904,8 @@ public final class ApplicationStartInfo implements Parcelable { sb.append(prefix) .append("ApplicationStartInfo ").append(seqSuffix).append(':') .append('\n') .append(" monotonicCreationTimeMs=").append(mMonoticCreationTimeMs) .append('\n') .append(" pid=").append(mPid) .append(" realUid=").append(mRealUid) .append(" packageUid=").append(mPackageUid) Loading Loading @@ -949,14 +974,15 @@ public final class ApplicationStartInfo implements Parcelable { && mDefiningUid == o.mDefiningUid && mReason == o.mReason && mStartupState == o.mStartupState && mStartType == o.mStartType && mLaunchMode == o.mLaunchMode && TextUtils.equals(mProcessName, o.mProcessName) && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped; && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped && mMonoticCreationTimeMs == o.mMonoticCreationTimeMs; } @Override public int hashCode() { return Objects.hash(mPid, mRealUid, mPackageUid, mDefiningUid, mReason, mStartupState, mStartType, mLaunchMode, mProcessName, mStartupTimestampsNs); mStartType, mLaunchMode, mProcessName, mStartupTimestampsNs, mMonoticCreationTimeMs); } private boolean timestampsEquals(@NonNull ApplicationStartInfo other) { Loading core/java/android/companion/CompanionDeviceManager.java +25 −23 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_P import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_COMPUTER; import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH; import static java.util.Collections.unmodifiableMap; import android.annotation.CallbackExecutor; import android.annotation.FlaggedApi; Loading Loading @@ -58,7 +57,6 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.util.ArrayMap; import android.util.ExceptionUtils; import android.util.Log; import android.util.SparseArray; Loading @@ -78,7 +76,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.BiConsumer; Loading Loading @@ -146,11 +143,18 @@ public final class CompanionDeviceManager { /** * The result code to propagate back to the user activity, indicates the internal error * in CompanionDeviceManager. * E.g. Missing necessary permissions or duplicate {@link AssociationRequest}s when create the * {@link AssociationInfo}. */ public static final int RESULT_INTERNAL_ERROR = 3; /** * The result code to propagate back to the user activity and * {@link Callback#onFailure(int, CharSequence)}, indicates app is not allow to create the * association due to the security issue. * E.g. There are missing necessary permissions when creating association. */ @FlaggedApi(Flags.FLAG_ASSOCIATION_FAILURE_CODE) public static final int RESULT_SECURITY_ERROR = 4; /** * Requesting applications will receive the String in {@link Callback#onFailure} if the * association dialog is explicitly declined by the users. E.g. press the Don't allow Loading Loading @@ -374,7 +378,6 @@ public final class CompanionDeviceManager { */ public void onAssociationCreated(@NonNull AssociationInfo associationInfo) {} //TODO(b/331459560): Add deprecated and remove abstract after API cut for W. /** * Invoked if the association could not be created. * Loading @@ -385,11 +388,15 @@ public final class CompanionDeviceManager { /** * Invoked if the association could not be created. * * @param resultCode indicate the particular reason why the association * Please note that both {@link #onFailure(CharSequence error)} and this * API will be called if the association could not be created. * * @param errorCode indicate the particular error code why the association * could not be created. * @param error error message. */ @FlaggedApi(Flags.FLAG_ASSOCIATION_FAILURE_CODE) public void onFailure(@ResultCode int resultCode) {} public void onFailure(@ResultCode int errorCode, @Nullable CharSequence error) {} } private final ICompanionDeviceManager mService; Loading Loading @@ -1825,12 +1832,12 @@ public final class CompanionDeviceManager { } @Override public void onFailure(@ResultCode int resultCode) { public void onFailure(@ResultCode int errorCode, @Nullable CharSequence error) { if (Flags.associationFailureCode()) { execute(mCallback::onFailure, resultCode); execute(mCallback::onFailure, errorCode, error); } execute(mCallback::onFailure, RESULT_CODE_TO_REASON.get(resultCode)); execute(mCallback::onFailure, error); } private <T> void execute(Consumer<T> callback, T arg) { Loading @@ -1840,6 +1847,12 @@ public final class CompanionDeviceManager { mHandler.post(() -> callback.accept(arg)); } } private <T, U> void execute(BiConsumer<T, U> callback, T arg1, U arg2) { if (mExecutor != null) { mExecutor.execute(() -> callback.accept(arg1, arg2)); } } } private static class OnAssociationsChangedListenerProxy Loading Loading @@ -2014,15 +2027,4 @@ public final class CompanionDeviceManager { } } } private static final Map<Integer, String> RESULT_CODE_TO_REASON; static { final Map<Integer, String> map = new ArrayMap<>(); map.put(RESULT_CANCELED, REASON_CANCELED); map.put(RESULT_USER_REJECTED, REASON_USER_REJECTED); map.put(RESULT_DISCOVERY_TIMEOUT, REASON_DISCOVERY_TIMEOUT); map.put(RESULT_INTERNAL_ERROR, REASON_INTERNAL_ERROR); RESULT_CODE_TO_REASON = unmodifiableMap(map); } } core/java/android/companion/IAssociationRequestCallback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,5 @@ interface IAssociationRequestCallback { oneway void onAssociationCreated(in AssociationInfo associationInfo); oneway void onFailure(in int resultCode); oneway void onFailure(in int errorCode, in CharSequence error); } No newline at end of file Loading
TEST_MAPPING +8 −2 Original line number Diff line number Diff line Loading @@ -140,11 +140,17 @@ "ravenwood-presubmit": [ { "name": "CtsUtilTestCasesRavenwood", "host": true "host": true, "file_patterns": [ "[Rr]avenwood" ] }, { "name": "RavenwoodBivalentTest", "host": true "host": true, "file_patterns": [ "[Rr]avenwood" ] } ], "postsubmit-managedprofile-stress": [ Loading
core/api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -9875,6 +9875,7 @@ package android.companion { field public static final int RESULT_DISCOVERY_TIMEOUT = 2; // 0x2 field public static final int RESULT_INTERNAL_ERROR = 3; // 0x3 field public static final int RESULT_OK = -1; // 0xffffffff field @FlaggedApi("android.companion.association_failure_code") public static final int RESULT_SECURITY_ERROR = 4; // 0x4 field public static final int RESULT_USER_REJECTED = 1; // 0x1 } Loading @@ -9884,7 +9885,7 @@ package android.companion { method public void onAssociationPending(@NonNull android.content.IntentSender); method @Deprecated public void onDeviceFound(@NonNull android.content.IntentSender); method public abstract void onFailure(@Nullable CharSequence); method @FlaggedApi("android.companion.association_failure_code") public void onFailure(int); method @FlaggedApi("android.companion.association_failure_code") public void onFailure(int, @Nullable CharSequence); } public abstract class CompanionDeviceService extends android.app.Service {
core/java/android/app/ApplicationStartInfo.java +30 −4 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ public final class ApplicationStartInfo implements Parcelable { /** Clock monotonic timestamp of surfaceflinger composition complete. */ public static final int START_TIMESTAMP_SURFACEFLINGER_COMPOSITION_COMPLETE = 7; /** * @see #getMonoticCreationTimeMs */ private long mMonoticCreationTimeMs; /** * @see #getStartupState */ Loading Loading @@ -486,6 +491,15 @@ public final class ApplicationStartInfo implements Parcelable { return mStartupState; } /** * Monotonic elapsed time persisted across reboots. * * @hide */ public long getMonoticCreationTimeMs() { return mMonoticCreationTimeMs; } /** * The process id. * Loading Loading @@ -669,7 +683,9 @@ public final class ApplicationStartInfo implements Parcelable { } /** @hide */ public ApplicationStartInfo() {} public ApplicationStartInfo(long monotonicCreationTimeMs) { mMonoticCreationTimeMs = monotonicCreationTimeMs; } /** @hide */ public ApplicationStartInfo(ApplicationStartInfo other) { Loading @@ -686,6 +702,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartIntent = other.mStartIntent; mLaunchMode = other.mLaunchMode; mWasForceStopped = other.mWasForceStopped; mMonoticCreationTimeMs = other.mMonoticCreationTimeMs; } private ApplicationStartInfo(@NonNull Parcel in) { Loading @@ -708,6 +725,7 @@ public final class ApplicationStartInfo implements Parcelable { in.readParcelable(Intent.class.getClassLoader(), android.content.Intent.class); mLaunchMode = in.readInt(); mWasForceStopped = in.readBoolean(); mMonoticCreationTimeMs = in.readLong(); } private static String intern(@Nullable String source) { Loading Loading @@ -786,6 +804,7 @@ public final class ApplicationStartInfo implements Parcelable { } proto.write(ApplicationStartInfoProto.LAUNCH_MODE, mLaunchMode); proto.write(ApplicationStartInfoProto.WAS_FORCE_STOPPED, mWasForceStopped); proto.write(ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS, mMonoticCreationTimeMs); proto.end(token); } Loading Loading @@ -869,6 +888,10 @@ public final class ApplicationStartInfo implements Parcelable { mWasForceStopped = proto.readBoolean( ApplicationStartInfoProto.WAS_FORCE_STOPPED); break; case (int) ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS: mMonoticCreationTimeMs = proto.readLong( ApplicationStartInfoProto.MONOTONIC_CREATION_TIME_MS); break; } } proto.end(token); Loading @@ -881,6 +904,8 @@ public final class ApplicationStartInfo implements Parcelable { sb.append(prefix) .append("ApplicationStartInfo ").append(seqSuffix).append(':') .append('\n') .append(" monotonicCreationTimeMs=").append(mMonoticCreationTimeMs) .append('\n') .append(" pid=").append(mPid) .append(" realUid=").append(mRealUid) .append(" packageUid=").append(mPackageUid) Loading Loading @@ -949,14 +974,15 @@ public final class ApplicationStartInfo implements Parcelable { && mDefiningUid == o.mDefiningUid && mReason == o.mReason && mStartupState == o.mStartupState && mStartType == o.mStartType && mLaunchMode == o.mLaunchMode && TextUtils.equals(mProcessName, o.mProcessName) && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped; && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped && mMonoticCreationTimeMs == o.mMonoticCreationTimeMs; } @Override public int hashCode() { return Objects.hash(mPid, mRealUid, mPackageUid, mDefiningUid, mReason, mStartupState, mStartType, mLaunchMode, mProcessName, mStartupTimestampsNs); mStartType, mLaunchMode, mProcessName, mStartupTimestampsNs, mMonoticCreationTimeMs); } private boolean timestampsEquals(@NonNull ApplicationStartInfo other) { Loading
core/java/android/companion/CompanionDeviceManager.java +25 −23 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_P import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_COMPUTER; import static android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH; import static java.util.Collections.unmodifiableMap; import android.annotation.CallbackExecutor; import android.annotation.FlaggedApi; Loading Loading @@ -58,7 +57,6 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.util.ArrayMap; import android.util.ExceptionUtils; import android.util.Log; import android.util.SparseArray; Loading @@ -78,7 +76,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.BiConsumer; Loading Loading @@ -146,11 +143,18 @@ public final class CompanionDeviceManager { /** * The result code to propagate back to the user activity, indicates the internal error * in CompanionDeviceManager. * E.g. Missing necessary permissions or duplicate {@link AssociationRequest}s when create the * {@link AssociationInfo}. */ public static final int RESULT_INTERNAL_ERROR = 3; /** * The result code to propagate back to the user activity and * {@link Callback#onFailure(int, CharSequence)}, indicates app is not allow to create the * association due to the security issue. * E.g. There are missing necessary permissions when creating association. */ @FlaggedApi(Flags.FLAG_ASSOCIATION_FAILURE_CODE) public static final int RESULT_SECURITY_ERROR = 4; /** * Requesting applications will receive the String in {@link Callback#onFailure} if the * association dialog is explicitly declined by the users. E.g. press the Don't allow Loading Loading @@ -374,7 +378,6 @@ public final class CompanionDeviceManager { */ public void onAssociationCreated(@NonNull AssociationInfo associationInfo) {} //TODO(b/331459560): Add deprecated and remove abstract after API cut for W. /** * Invoked if the association could not be created. * Loading @@ -385,11 +388,15 @@ public final class CompanionDeviceManager { /** * Invoked if the association could not be created. * * @param resultCode indicate the particular reason why the association * Please note that both {@link #onFailure(CharSequence error)} and this * API will be called if the association could not be created. * * @param errorCode indicate the particular error code why the association * could not be created. * @param error error message. */ @FlaggedApi(Flags.FLAG_ASSOCIATION_FAILURE_CODE) public void onFailure(@ResultCode int resultCode) {} public void onFailure(@ResultCode int errorCode, @Nullable CharSequence error) {} } private final ICompanionDeviceManager mService; Loading Loading @@ -1825,12 +1832,12 @@ public final class CompanionDeviceManager { } @Override public void onFailure(@ResultCode int resultCode) { public void onFailure(@ResultCode int errorCode, @Nullable CharSequence error) { if (Flags.associationFailureCode()) { execute(mCallback::onFailure, resultCode); execute(mCallback::onFailure, errorCode, error); } execute(mCallback::onFailure, RESULT_CODE_TO_REASON.get(resultCode)); execute(mCallback::onFailure, error); } private <T> void execute(Consumer<T> callback, T arg) { Loading @@ -1840,6 +1847,12 @@ public final class CompanionDeviceManager { mHandler.post(() -> callback.accept(arg)); } } private <T, U> void execute(BiConsumer<T, U> callback, T arg1, U arg2) { if (mExecutor != null) { mExecutor.execute(() -> callback.accept(arg1, arg2)); } } } private static class OnAssociationsChangedListenerProxy Loading Loading @@ -2014,15 +2027,4 @@ public final class CompanionDeviceManager { } } } private static final Map<Integer, String> RESULT_CODE_TO_REASON; static { final Map<Integer, String> map = new ArrayMap<>(); map.put(RESULT_CANCELED, REASON_CANCELED); map.put(RESULT_USER_REJECTED, REASON_USER_REJECTED); map.put(RESULT_DISCOVERY_TIMEOUT, REASON_DISCOVERY_TIMEOUT); map.put(RESULT_INTERNAL_ERROR, REASON_INTERNAL_ERROR); RESULT_CODE_TO_REASON = unmodifiableMap(map); } }
core/java/android/companion/IAssociationRequestCallback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,5 @@ interface IAssociationRequestCallback { oneway void onAssociationCreated(in AssociationInfo associationInfo); oneway void onFailure(in int resultCode); oneway void onFailure(in int errorCode, in CharSequence error); } No newline at end of file