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

Commit e95bc0fe authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9253587 from 2546f800 to tm-qpr2-release

Change-Id: I90e76700ebd07eec3812c660bb18828460be2bc0
parents 2d146642 2546f800
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -87,10 +87,12 @@ import android.os.Parcelable;
import android.os.PersistableBundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.StrictMode;
import android.os.Trace;
import android.os.UserHandle;
import android.service.voice.VoiceInteractionSession;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -154,6 +156,7 @@ import android.window.WindowOnBackInvokedDispatcher;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IVoiceInteractionManagerService;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.app.ToolbarActionBar;
import com.android.internal.app.WindowDecorActionBar;
@@ -1601,6 +1604,25 @@ public class Activity extends ContextThemeWrapper
        return callbacks;
    }

    private void notifyVoiceInteractionManagerServiceActivityEvent(
            @VoiceInteractionSession.VoiceInteractionActivityEventType int type) {

        final IVoiceInteractionManagerService service =
                IVoiceInteractionManagerService.Stub.asInterface(
                        ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
        if (service == null) {
            Log.w(TAG, "notifyVoiceInteractionManagerServiceActivityEvent: Can not get "
                    + "VoiceInteractionManagerService");
            return;
        }

        try {
            service.notifyActivityEventChanged(mToken, type);
        } catch (RemoteException e) {
            // Empty
        }
    }

    /**
     * Called when the activity is starting.  This is where most initialization
     * should go: calling {@link #setContentView(int)} to inflate the
@@ -1876,6 +1898,9 @@ public class Activity extends ContextThemeWrapper
        mCalled = true;

        notifyContentCaptureManagerIfNeeded(CONTENT_CAPTURE_START);

        notifyVoiceInteractionManagerServiceActivityEvent(
                VoiceInteractionSession.VOICE_INTERACTION_ACTIVITY_EVENT_START);
    }

    /**
@@ -2019,6 +2044,12 @@ public class Activity extends ContextThemeWrapper
        final Window win = getWindow();
        if (win != null) win.makeActive();
        if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true);

        // Because the test case "com.android.launcher3.jank.BinderTests#testPressHome" doesn't
        // allow any binder call in onResume, we call this method in onPostResume.
        notifyVoiceInteractionManagerServiceActivityEvent(
                VoiceInteractionSession.VOICE_INTERACTION_ACTIVITY_EVENT_RESUME);

        mCalled = true;
    }

@@ -2394,6 +2425,10 @@ public class Activity extends ContextThemeWrapper
        getAutofillClientController().onActivityPaused();

        notifyContentCaptureManagerIfNeeded(CONTENT_CAPTURE_PAUSE);

        notifyVoiceInteractionManagerServiceActivityEvent(
                VoiceInteractionSession.VOICE_INTERACTION_ACTIVITY_EVENT_PAUSE);

        mCalled = true;
    }

@@ -2623,6 +2658,9 @@ public class Activity extends ContextThemeWrapper

        getAutofillClientController().onActivityStopped(mIntent, mChangingConfigurations);
        mEnterAnimationComplete = false;

        notifyVoiceInteractionManagerServiceActivityEvent(
                VoiceInteractionSession.VOICE_INTERACTION_ACTIVITY_EVENT_STOP);
    }

    /**
+2 −3
Original line number Diff line number Diff line
@@ -731,10 +731,9 @@ public abstract class ActivityManagerInternal {
     */
    public interface VoiceInteractionManagerProvider {
        /**
         * Notifies the service when a high-level activity event has been changed, for example,
         * an activity was resumed or stopped.
         * Notifies the service when an activity is destroyed.
         */
        void notifyActivityEventChanged();
        void notifyActivityDestroyed(IBinder activityToken);
    }

    /**
+37 −0
Original line number Diff line number Diff line
@@ -42,12 +42,15 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.RemoteViews;

import com.android.internal.appwidget.IAppWidgetService;
import com.android.internal.os.BackgroundThread;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * Updates AppWidget state; gets information about installed AppWidget providers and other
@@ -63,6 +66,7 @@ import java.util.List;
@RequiresFeature(PackageManager.FEATURE_APP_WIDGETS)
public class AppWidgetManager {


    /**
     * Activity action to launch from your {@link AppWidgetHost} activity when you want to
     * pick an AppWidget to display.  The AppWidget picker activity will be launched.
@@ -331,6 +335,17 @@ public class AppWidgetManager {
    @BroadcastBehavior(explicitOnly = true)
    public static final String ACTION_APPWIDGET_UPDATE = "android.appwidget.action.APPWIDGET_UPDATE";

    /**
     * A combination broadcast of APPWIDGET_ENABLED and APPWIDGET_UPDATE.
     * Sent during boot time and when the host is binding the widget for the very first time
     *
     * @hide
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @BroadcastBehavior(explicitOnly = true)
    public static final String ACTION_APPWIDGET_ENABLE_AND_UPDATE = "android.appwidget.action"
            + ".APPWIDGET_ENABLE_AND_UPDATE";

    /**
     * Sent when the custom extras for an AppWidget change.
     *
@@ -456,6 +471,8 @@ public class AppWidgetManager {
    public static final String ACTION_APPWIDGET_HOST_RESTORED
            = "android.appwidget.action.APPWIDGET_HOST_RESTORED";

    private static final String TAG = "AppWidgetManager";

    /**
     * An intent extra that contains multiple appWidgetIds.  These are id values as
     * they were provided to the application during a recent restore from backup.  It is
@@ -511,6 +528,26 @@ public class AppWidgetManager {
        mPackageName = context.getOpPackageName();
        mService = service;
        mDisplayMetrics = context.getResources().getDisplayMetrics();
        if (mService == null) {
            return;
        }
        BackgroundThread.getExecutor().execute(() -> {
            try {
                mService.notifyProviderInheritance(getInstalledProvidersForPackage(mPackageName,
                        null)
                        .stream().filter(Objects::nonNull)
                        .map(info -> info.provider).filter(p -> {
                            try {
                                Class clazz = Class.forName(p.getClassName());
                                return AppWidgetProvider.class.isAssignableFrom(clazz);
                            } catch (Exception e) {
                                return false;
                            }
                        }).toArray(ComponentName[]::new));
            } catch (Exception e) {
                Log.e(TAG, "Nofity service of inheritance info", e);
            }
        });
    }

    /**
+6 −1
Original line number Diff line number Diff line
@@ -58,7 +58,12 @@ public class AppWidgetProvider extends BroadcastReceiver {
        // Protect against rogue update broadcasts (not really a security issue,
        // just filter bad broacasts out so subclasses are less likely to crash).
        String action = intent.getAction();
        if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
        if (AppWidgetManager.ACTION_APPWIDGET_ENABLE_AND_UPDATE.equals(action)) {
            this.onReceive(context, new Intent(intent)
                    .setAction(AppWidgetManager.ACTION_APPWIDGET_ENABLED));
            this.onReceive(context, new Intent(intent)
                    .setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE));
        } else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
            Bundle extras = intent.getExtras();
            if (extras != null) {
                int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
+0 −1
Original line number Diff line number Diff line
@@ -918,7 +918,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }
    }


    /**
     * Forwards BiometricStateListener to FingerprintService
     * @param listener new BiometricStateListener being added
Loading