Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59cfcb50 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "ShortcutManager: finishing touches" into nyc-dev am: 7d164d35" into nyc-mr1-dev

parents c57dfea1 c0cd95b0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ interface IShortcutService {

    void resetThrottling(); // system only API for developer opsions

    void onApplicationActive(String packageName, int userId); // system only API for sysUI

    byte[] getBackupPayload(int user);

    void applyRestore(in byte[] payload, int user);
+17 −16
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Icon;
@@ -35,8 +34,6 @@ import com.android.internal.util.Preconditions;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

// TODO Enhance javadoc
@@ -307,14 +304,6 @@ public final class ShortcutInfo implements Parcelable {
            case Icon.TYPE_RESOURCE:
            case Icon.TYPE_BITMAP:
                break; // OK
            case Icon.TYPE_URI:
                if (ContentResolver.SCHEME_CONTENT.equals(icon.getUri().getScheme())) {
                    break;
                }
                // Note "file:" is not supported, because depending on the path, system server
                // cannot access it. // TODO Revisit "file:" icon support

                // fall through
            default:
                throw getInvalidIconException();
        }
@@ -374,6 +363,12 @@ public final class ShortcutInfo implements Parcelable {
         * Optionally sets the target activity.  If it's not set, and if the caller application
         * has multiple launcher icons, this shortcut will be shown on all those icons.
         * If it's set, this shortcut will be only shown on this activity.
         *
         * <p>The package name of the target activity must match the package name of the shortcut
         * publisher.
         *
         * <p>This has nothing to do with the activity that this shortcut will launch.  This is
         * a hint to the launcher app about which launcher icon to associate this shortcut with.
         */
        @NonNull
        public Builder setActivityComponent(@NonNull ComponentName activityComponent) {
@@ -385,11 +380,8 @@ public final class ShortcutInfo implements Parcelable {
         * Optionally sets an icon.
         *
         * <ul>
         *     <li>Tints are not supported.
         *     <li>Bitmaps, resources and "content:" URIs are supported.
         *     <li>"content:" URI will be fetched when a shortcut is registered to
         *         {@link ShortcutManager}.  Changing the content from the same URI later will
         *         not be reflected to launcher icons.
         *     <li>Tints set by {@link Icon#setTint} or {@link Icon#setTintList} are not supported.
         *     <li>Bitmaps and resources are supported, but "content:" URIs are not supported.
         * </ul>
         *
         * <p>For performance reasons, icons will <b>NOT</b> be available on instances
@@ -498,6 +490,11 @@ public final class ShortcutInfo implements Parcelable {
    /**
     * Return the target activity, which may be null, in which case the shortcut is not associated
     * with a specific activity.
     *
     * <p>This has nothing to do with the activity that this shortcut will launch.  This is
     * a hint to the launcher app that on which launcher icon this shortcut should be shown.
     *
     * @see Builder#setActivityComponent
     */
    @Nullable
    public ComponentName getActivityComponent() {
@@ -550,6 +547,10 @@ public final class ShortcutInfo implements Parcelable {
     *
     * <p>All shortcuts must have an intent, but this method will return null when
     * {@link #hasKeyFieldsOnly()} is true.
     *
     * <p>Launcher apps <b>cannot</b> see the intent.  If a {@link ShortcutInfo} is obtained via
     * {@link LauncherApps}, then this method will always return null.  Launcher apps can only
     * start a shortcut intent with {@link LauncherApps#startShortcut}.
     */
    @Nullable
    public Intent getIntent() {
+6 −2
Original line number Diff line number Diff line
@@ -62,13 +62,17 @@ import java.util.List;
 * <h3>Rate limiting</h3>
 *
 * Calls to {@link #setDynamicShortcuts(List)}, {@link #addDynamicShortcuts(List)},
 * and {@link #updateShortcuts(List)} will be
 * and {@link #updateShortcuts(List)} from <b>background applications</b> will be
 * rate-limited.  An application can call these methods at most
 * {@link #getRemainingCallCount()} times until the rate-limiting counter is reset,
 * which happens every hour.
 * which happens at a certain time every day.
 *
 * <p>An application can use {@link #getRateLimitResetTime()} to get the next reset time.
 *
 * <p>Foreground applications (i.e. ones with a foreground activity or a foreground services)
 * will not be throttled. Also, when an application comes to foreground,
 * {@link #getRemainingCallCount()} will be reset to the initial value.
 *
 * <p>For testing purposes, use "Developer Options" (found in the Settings menu) to reset the
 * internal rate-limiting counter.  Automated tests can use the following ADB shell command to
 * achieve the same effect:</p>
+6 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.LauncherApps.ShortcutQuery;
import android.os.ParcelFileDescriptor;
import android.os.UserHandle;

import java.util.List;

@@ -68,4 +67,10 @@ public abstract class ShortcutServiceInternal {

    public abstract boolean hasShortcutHostPermission(int launcherUserId,
            @NonNull String callingPackage);

    /**
     * Called by AM when the system locale changes *within the AM lock*.  ABSOLUTELY do not take
     * any locks in this method.
     */
    public abstract void onSystemLocaleChangedNoLock();
}
+5 −0
Original line number Diff line number Diff line
@@ -1989,6 +1989,11 @@
    <permission android:name="android.permission.UPDATE_CONFIG"
        android:protectionLevel="signature|privileged" />

    <!-- Allows the system to reset throttling in shortcut manager.
         @hide -->
    <permission android:name="android.permission.RESET_SHORTCUT_MANAGER_THROTTLING"
        android:protectionLevel="signature" />

    <!-- ========================================= -->
    <!-- Permissions for special development tools -->
    <!-- ========================================= -->
Loading