Loading api/system-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -1092,11 +1092,12 @@ package android.app.prediction { } public static final class AppTarget.Builder { ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull String, @NonNull android.os.UserHandle); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull android.content.pm.ShortcutInfo); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId); method @NonNull public android.app.prediction.AppTarget build(); method @NonNull public android.app.prediction.AppTarget.Builder setClassName(@NonNull String); method @NonNull public android.app.prediction.AppTarget.Builder setRank(@IntRange(from=0) int); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo); } public final class AppTargetEvent implements android.os.Parcelable { Loading api/test-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -498,11 +498,12 @@ package android.app.prediction { } public static final class AppTarget.Builder { ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull String, @NonNull android.os.UserHandle); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull android.content.pm.ShortcutInfo); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId); method @NonNull public android.app.prediction.AppTarget build(); method @NonNull public android.app.prediction.AppTarget.Builder setClassName(@NonNull String); method @NonNull public android.app.prediction.AppTarget.Builder setRank(@IntRange(from=0) int); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo); } public final class AppTargetEvent implements android.os.Parcelable { Loading core/java/android/app/prediction/AppTarget.java +14 −39 Original line number Diff line number Diff line Loading @@ -203,50 +203,25 @@ public final class AppTarget implements Parcelable { private String mClassName; private int mRank; /** * @deprecated Use the other Builder constructors. * @hide */ @Deprecated public Builder(@NonNull AppTargetId id) { mId = id; } /** * @param id A unique id for this launchable target. * @param packageName PackageName of the target. * @param user The UserHandle of the user which this target belongs to. * @hide */ @SystemApi @TestApi public Builder(@NonNull AppTargetId id, @NonNull String packageName, @NonNull UserHandle user) { mId = Preconditions.checkNotNull(id); mPackageName = Preconditions.checkNotNull(packageName); mUser = Preconditions.checkNotNull(user); } /** * @param id A unique id for this launchable target. * @param info The ShortcutInfo that represents this launchable target. * @hide */ @SystemApi @TestApi public Builder(@NonNull AppTargetId id, @NonNull ShortcutInfo info) { mId = Preconditions.checkNotNull(id); mShortcutInfo = Preconditions.checkNotNull(info); mPackageName = info.getPackage(); mUser = info.getUserHandle(); public Builder(@NonNull AppTargetId id) { mId = id; } /** * @deprecated Use the appropriate constructor. * @hide * Sets the target to be an app. * * @param packageName PackageName of the app * @param user The UserHandle of the user which this target belongs to. * * @throws IllegalArgumentException is the target is already set */ @NonNull @Deprecated public Builder setTarget(@NonNull String packageName, @NonNull UserHandle user) { if (mPackageName != null) { throw new IllegalArgumentException("Target is already set"); Loading @@ -257,11 +232,11 @@ public final class AppTarget implements Parcelable { } /** * @deprecated Use the appropriate constructor. * @hide * Sets the target to be a ShortcutInfo. * * @throws IllegalArgumentException is the target is already set */ @NonNull @Deprecated public Builder setTarget(@NonNull ShortcutInfo info) { setTarget(info.getPackage(), info.getUserHandle()); mShortcutInfo = Preconditions.checkNotNull(info); Loading @@ -269,7 +244,7 @@ public final class AppTarget implements Parcelable { } /** * Sets the className for the target. * Sets the className for the target */ @NonNull public Builder setClassName(@NonNull String className) { Loading @@ -278,7 +253,7 @@ public final class AppTarget implements Parcelable { } /** * Sets the rank of the target. * Sets the rank of the for the target. */ @NonNull public Builder setRank(@IntRange(from = 0) int rank) { Loading @@ -299,7 +274,7 @@ public final class AppTarget implements Parcelable { @NonNull public AppTarget build() { if (mPackageName == null) { throw new IllegalStateException("No target is set"); throw new IllegalStateException("No target set"); } return new AppTarget(mId, mPackageName, mUser, mShortcutInfo, mClassName, mRank); } Loading core/java/com/android/internal/app/ChooserActivity.java +5 −5 Original line number Diff line number Diff line Loading @@ -1349,12 +1349,12 @@ public class ChooserActivity extends ResolverActivity { appPredictor.notifyAppTargetEvent( new AppTargetEvent.Builder( // TODO(b/124404997) Send full shortcut info, not just Id with AppTargetId. new AppTarget.Builder(new AppTargetId(shortcutId), componentName.getPackageName(), getUser()) new AppTarget.Builder(new AppTargetId(shortcutId)) .setTarget(componentName.getPackageName(), getUser()) .setClassName(componentName.getClassName()) .build(), AppTargetEvent.ACTION_LAUNCH) .setLaunchLocation(LAUNCH_LOCATON_DIRECT_SHARE) AppTargetEvent.ACTION_LAUNCH ).setLaunchLocation(LAUNCH_LOCATON_DIRECT_SHARE) .build()); } Loading core/jni/android_nio_utils.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -18,42 +18,51 @@ #include "core_jni_helpers.h" void* android::nio_getPointer(JNIEnv *_env, jobject buffer, jarray *array) { assert(array); namespace { void* getPointer(JNIEnv *_env, jobject buffer, jarray *array, void** elements) { assert(array); jint position; jint limit; jint elementSizeShift; jlong pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift); if (pointer != 0L) { *array = nullptr; *elements = nullptr; pointer += position << elementSizeShift; return reinterpret_cast<void*>(pointer); } jint offset = jniGetNioBufferBaseArrayOffset(_env, buffer); *array = jniGetNioBufferBaseArray(_env, buffer); void * data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); return reinterpret_cast<void*>(reinterpret_cast<char*>(data) + offset); *elements = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); return reinterpret_cast<void*>(reinterpret_cast<char*>(*elements) + offset); } void releasePointer(JNIEnv *_env, jarray array, void *elements, jboolean commit) { _env->ReleasePrimitiveArrayCritical(array, elements, commit ? 0 : JNI_ABORT); } } // namespace void* android::nio_getPointer(JNIEnv *_env, jobject buffer, jarray *array) { void* elements; return getPointer(_env, buffer, array, &elements); } void android::nio_releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) { _env->ReleasePrimitiveArrayCritical(array, data, commit ? 0 : JNI_ABORT); void android::nio_releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) { releasePointer(_env, array, data, commit); } /////////////////////////////////////////////////////////////////////////////// android::AutoBufferPointer::AutoBufferPointer(JNIEnv* env, jobject nioBuffer, jboolean commit) { android::AutoBufferPointer::AutoBufferPointer(JNIEnv* env, jobject nioBuffer, jboolean commit) { fEnv = env; fCommit = commit; fPointer = android::nio_getPointer(env, nioBuffer, &fArray); fPointer = getPointer(env, nioBuffer, &fArray, &fElements); } android::AutoBufferPointer::~AutoBufferPointer() { if (NULL != fArray) { android::nio_releasePointer(fEnv, fArray, fPointer, fCommit); if (nullptr != fArray) { releasePointer(fEnv, fArray, fElements, fCommit); } } Loading
api/system-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -1092,11 +1092,12 @@ package android.app.prediction { } public static final class AppTarget.Builder { ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull String, @NonNull android.os.UserHandle); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull android.content.pm.ShortcutInfo); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId); method @NonNull public android.app.prediction.AppTarget build(); method @NonNull public android.app.prediction.AppTarget.Builder setClassName(@NonNull String); method @NonNull public android.app.prediction.AppTarget.Builder setRank(@IntRange(from=0) int); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo); } public final class AppTargetEvent implements android.os.Parcelable { Loading
api/test-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -498,11 +498,12 @@ package android.app.prediction { } public static final class AppTarget.Builder { ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull String, @NonNull android.os.UserHandle); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull android.content.pm.ShortcutInfo); ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId); method @NonNull public android.app.prediction.AppTarget build(); method @NonNull public android.app.prediction.AppTarget.Builder setClassName(@NonNull String); method @NonNull public android.app.prediction.AppTarget.Builder setRank(@IntRange(from=0) int); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle); method @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo); } public final class AppTargetEvent implements android.os.Parcelable { Loading
core/java/android/app/prediction/AppTarget.java +14 −39 Original line number Diff line number Diff line Loading @@ -203,50 +203,25 @@ public final class AppTarget implements Parcelable { private String mClassName; private int mRank; /** * @deprecated Use the other Builder constructors. * @hide */ @Deprecated public Builder(@NonNull AppTargetId id) { mId = id; } /** * @param id A unique id for this launchable target. * @param packageName PackageName of the target. * @param user The UserHandle of the user which this target belongs to. * @hide */ @SystemApi @TestApi public Builder(@NonNull AppTargetId id, @NonNull String packageName, @NonNull UserHandle user) { mId = Preconditions.checkNotNull(id); mPackageName = Preconditions.checkNotNull(packageName); mUser = Preconditions.checkNotNull(user); } /** * @param id A unique id for this launchable target. * @param info The ShortcutInfo that represents this launchable target. * @hide */ @SystemApi @TestApi public Builder(@NonNull AppTargetId id, @NonNull ShortcutInfo info) { mId = Preconditions.checkNotNull(id); mShortcutInfo = Preconditions.checkNotNull(info); mPackageName = info.getPackage(); mUser = info.getUserHandle(); public Builder(@NonNull AppTargetId id) { mId = id; } /** * @deprecated Use the appropriate constructor. * @hide * Sets the target to be an app. * * @param packageName PackageName of the app * @param user The UserHandle of the user which this target belongs to. * * @throws IllegalArgumentException is the target is already set */ @NonNull @Deprecated public Builder setTarget(@NonNull String packageName, @NonNull UserHandle user) { if (mPackageName != null) { throw new IllegalArgumentException("Target is already set"); Loading @@ -257,11 +232,11 @@ public final class AppTarget implements Parcelable { } /** * @deprecated Use the appropriate constructor. * @hide * Sets the target to be a ShortcutInfo. * * @throws IllegalArgumentException is the target is already set */ @NonNull @Deprecated public Builder setTarget(@NonNull ShortcutInfo info) { setTarget(info.getPackage(), info.getUserHandle()); mShortcutInfo = Preconditions.checkNotNull(info); Loading @@ -269,7 +244,7 @@ public final class AppTarget implements Parcelable { } /** * Sets the className for the target. * Sets the className for the target */ @NonNull public Builder setClassName(@NonNull String className) { Loading @@ -278,7 +253,7 @@ public final class AppTarget implements Parcelable { } /** * Sets the rank of the target. * Sets the rank of the for the target. */ @NonNull public Builder setRank(@IntRange(from = 0) int rank) { Loading @@ -299,7 +274,7 @@ public final class AppTarget implements Parcelable { @NonNull public AppTarget build() { if (mPackageName == null) { throw new IllegalStateException("No target is set"); throw new IllegalStateException("No target set"); } return new AppTarget(mId, mPackageName, mUser, mShortcutInfo, mClassName, mRank); } Loading
core/java/com/android/internal/app/ChooserActivity.java +5 −5 Original line number Diff line number Diff line Loading @@ -1349,12 +1349,12 @@ public class ChooserActivity extends ResolverActivity { appPredictor.notifyAppTargetEvent( new AppTargetEvent.Builder( // TODO(b/124404997) Send full shortcut info, not just Id with AppTargetId. new AppTarget.Builder(new AppTargetId(shortcutId), componentName.getPackageName(), getUser()) new AppTarget.Builder(new AppTargetId(shortcutId)) .setTarget(componentName.getPackageName(), getUser()) .setClassName(componentName.getClassName()) .build(), AppTargetEvent.ACTION_LAUNCH) .setLaunchLocation(LAUNCH_LOCATON_DIRECT_SHARE) AppTargetEvent.ACTION_LAUNCH ).setLaunchLocation(LAUNCH_LOCATON_DIRECT_SHARE) .build()); } Loading
core/jni/android_nio_utils.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -18,42 +18,51 @@ #include "core_jni_helpers.h" void* android::nio_getPointer(JNIEnv *_env, jobject buffer, jarray *array) { assert(array); namespace { void* getPointer(JNIEnv *_env, jobject buffer, jarray *array, void** elements) { assert(array); jint position; jint limit; jint elementSizeShift; jlong pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift); if (pointer != 0L) { *array = nullptr; *elements = nullptr; pointer += position << elementSizeShift; return reinterpret_cast<void*>(pointer); } jint offset = jniGetNioBufferBaseArrayOffset(_env, buffer); *array = jniGetNioBufferBaseArray(_env, buffer); void * data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); return reinterpret_cast<void*>(reinterpret_cast<char*>(data) + offset); *elements = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); return reinterpret_cast<void*>(reinterpret_cast<char*>(*elements) + offset); } void releasePointer(JNIEnv *_env, jarray array, void *elements, jboolean commit) { _env->ReleasePrimitiveArrayCritical(array, elements, commit ? 0 : JNI_ABORT); } } // namespace void* android::nio_getPointer(JNIEnv *_env, jobject buffer, jarray *array) { void* elements; return getPointer(_env, buffer, array, &elements); } void android::nio_releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) { _env->ReleasePrimitiveArrayCritical(array, data, commit ? 0 : JNI_ABORT); void android::nio_releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) { releasePointer(_env, array, data, commit); } /////////////////////////////////////////////////////////////////////////////// android::AutoBufferPointer::AutoBufferPointer(JNIEnv* env, jobject nioBuffer, jboolean commit) { android::AutoBufferPointer::AutoBufferPointer(JNIEnv* env, jobject nioBuffer, jboolean commit) { fEnv = env; fCommit = commit; fPointer = android::nio_getPointer(env, nioBuffer, &fArray); fPointer = getPointer(env, nioBuffer, &fArray, &fElements); } android::AutoBufferPointer::~AutoBufferPointer() { if (NULL != fArray) { android::nio_releasePointer(fEnv, fArray, fPointer, fCommit); if (nullptr != fArray) { releasePointer(fEnv, fArray, fElements, fCommit); } }