Merge "[a11y] Fix crash when using talkback to add to home screen." into udc-qpr-dev am: 18e0e1e50a am: d91ee8f9af

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23849395

Change-Id: I2c5cc943205c9fb6528090ee64d539e0f0dca3a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Holly Jiuyu Sun
2023-06-30 19:06:02 +00:00
committed by Automerger Merge Worker
5 changed files with 23 additions and 16 deletions
@@ -24,6 +24,8 @@ import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import com.android.launcher3.util.StartActivityParams;
public class ProxyActivityStarter extends Activity {
private static final String TAG = "ProxyActivityStarter";
@@ -1,117 +0,0 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.proxy;
import static android.app.PendingIntent.FLAG_MUTABLE;
import static android.app.PendingIntent.FLAG_ONE_SHOT;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
import static com.android.launcher3.Utilities.allowBGLaunch;
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
public class StartActivityParams implements Parcelable {
private static final String TAG = "StartActivityParams";
private final PendingIntent mPICallback;
public final int requestCode;
public Intent intent;
public IntentSender intentSender;
public Intent fillInIntent;
public int flagsMask;
public int flagsValues;
public int extraFlags;
public Bundle options;
public StartActivityParams(Activity activity, int requestCode) {
this(activity.createPendingResult(requestCode, new Intent(),
FLAG_ONE_SHOT | FLAG_UPDATE_CURRENT | FLAG_MUTABLE), requestCode);
}
public StartActivityParams(PendingIntent pendingIntent, int requestCode) {
this.mPICallback = pendingIntent;
this.requestCode = requestCode;
}
private StartActivityParams(Parcel parcel) {
mPICallback = parcel.readTypedObject(PendingIntent.CREATOR);
requestCode = parcel.readInt();
intent = parcel.readTypedObject(Intent.CREATOR);
intentSender = parcel.readTypedObject(IntentSender.CREATOR);
fillInIntent = parcel.readTypedObject(Intent.CREATOR);
flagsMask = parcel.readInt();
flagsValues = parcel.readInt();
extraFlags = parcel.readInt();
options = parcel.readBundle();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeTypedObject(mPICallback, flags);
parcel.writeInt(requestCode);
parcel.writeTypedObject(intent, flags);
parcel.writeTypedObject(intentSender, flags);
parcel.writeTypedObject(fillInIntent, flags);
parcel.writeInt(flagsMask);
parcel.writeInt(flagsValues);
parcel.writeInt(extraFlags);
parcel.writeBundle(options);
}
public void deliverResult(Context context, int resultCode, Intent data) {
ActivityOptions options = allowBGLaunch(ActivityOptions.makeBasic());
try {
if (mPICallback != null) {
mPICallback.send(context, resultCode, data, null, null, null, options.toBundle());
}
} catch (CanceledException e) {
Log.e(TAG, "Unable to send back result", e);
}
}
public static final Parcelable.Creator<StartActivityParams> CREATOR =
new Parcelable.Creator<StartActivityParams>() {
public StartActivityParams createFromParcel(Parcel source) {
return new StartActivityParams(source);
}
public StartActivityParams[] newArray(int size) {
return new StartActivityParams[size];
}
};
}
@@ -120,7 +120,6 @@ import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.proxy.ProxyActivityStarter;
import com.android.launcher3.proxy.StartActivityParams;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
@@ -152,6 +151,7 @@ import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource;
import com.android.launcher3.util.StartActivityParams;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.widget.LauncherWidgetHolder;
import com.android.quickstep.OverviewCommandHelper;