Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package androidx.browser.customtabs;
import android.os.Bundle;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@RequiresApi(33)
/* loaded from: classes.dex */
class Api33Impl {
private Api33Impl() {
}
@DoNotInline
public static <T> T getParcelable(@NonNull Bundle bundle, @Nullable String str, @NonNull Class<T> cls) {
return (T) bundle.getParcelable(str, cls);
}
}

View File

@@ -0,0 +1,133 @@
package androidx.browser.customtabs;
import android.os.Bundle;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
public final class CustomTabColorSchemeParams {
@Nullable
@ColorInt
public final Integer navigationBarColor;
@Nullable
@ColorInt
public final Integer navigationBarDividerColor;
@Nullable
@ColorInt
public final Integer secondaryToolbarColor;
@Nullable
@ColorInt
public final Integer toolbarColor;
public CustomTabColorSchemeParams(@Nullable @ColorInt Integer num, @Nullable @ColorInt Integer num2, @Nullable @ColorInt Integer num3, @Nullable @ColorInt Integer num4) {
this.toolbarColor = num;
this.secondaryToolbarColor = num2;
this.navigationBarColor = num3;
this.navigationBarDividerColor = num4;
}
@NonNull
public Bundle toBundle() {
Bundle bundle = new Bundle();
Integer num = this.toolbarColor;
if (num != null) {
bundle.putInt(CustomTabsIntent.EXTRA_TOOLBAR_COLOR, num.intValue());
}
Integer num2 = this.secondaryToolbarColor;
if (num2 != null) {
bundle.putInt(CustomTabsIntent.EXTRA_SECONDARY_TOOLBAR_COLOR, num2.intValue());
}
Integer num3 = this.navigationBarColor;
if (num3 != null) {
bundle.putInt(CustomTabsIntent.EXTRA_NAVIGATION_BAR_COLOR, num3.intValue());
}
Integer num4 = this.navigationBarDividerColor;
if (num4 != null) {
bundle.putInt(CustomTabsIntent.EXTRA_NAVIGATION_BAR_DIVIDER_COLOR, num4.intValue());
}
return bundle;
}
@NonNull
public static CustomTabColorSchemeParams fromBundle(@Nullable Bundle bundle) {
if (bundle == null) {
bundle = new Bundle(0);
}
return new CustomTabColorSchemeParams((Integer) bundle.get(CustomTabsIntent.EXTRA_TOOLBAR_COLOR), (Integer) bundle.get(CustomTabsIntent.EXTRA_SECONDARY_TOOLBAR_COLOR), (Integer) bundle.get(CustomTabsIntent.EXTRA_NAVIGATION_BAR_COLOR), (Integer) bundle.get(CustomTabsIntent.EXTRA_NAVIGATION_BAR_DIVIDER_COLOR));
}
@NonNull
public CustomTabColorSchemeParams withDefaults(@NonNull CustomTabColorSchemeParams customTabColorSchemeParams) {
Integer num = this.toolbarColor;
if (num == null) {
num = customTabColorSchemeParams.toolbarColor;
}
Integer num2 = this.secondaryToolbarColor;
if (num2 == null) {
num2 = customTabColorSchemeParams.secondaryToolbarColor;
}
Integer num3 = this.navigationBarColor;
if (num3 == null) {
num3 = customTabColorSchemeParams.navigationBarColor;
}
Integer num4 = this.navigationBarDividerColor;
if (num4 == null) {
num4 = customTabColorSchemeParams.navigationBarDividerColor;
}
return new CustomTabColorSchemeParams(num, num2, num3, num4);
}
public static final class Builder {
@Nullable
@ColorInt
private Integer mNavigationBarColor;
@Nullable
@ColorInt
private Integer mNavigationBarDividerColor;
@Nullable
@ColorInt
private Integer mSecondaryToolbarColor;
@Nullable
@ColorInt
private Integer mToolbarColor;
@NonNull
public Builder setToolbarColor(@ColorInt int i) {
this.mToolbarColor = Integer.valueOf(i | ViewCompat.MEASURED_STATE_MASK);
return this;
}
@NonNull
public Builder setSecondaryToolbarColor(@ColorInt int i) {
this.mSecondaryToolbarColor = Integer.valueOf(i);
return this;
}
@NonNull
public Builder setNavigationBarColor(@ColorInt int i) {
this.mNavigationBarColor = Integer.valueOf(i | ViewCompat.MEASURED_STATE_MASK);
return this;
}
@NonNull
public Builder setNavigationBarDividerColor(@ColorInt int i) {
this.mNavigationBarDividerColor = Integer.valueOf(i);
return this;
}
@NonNull
public CustomTabColorSchemeParams build() {
return new CustomTabColorSchemeParams(this.mToolbarColor, this.mSecondaryToolbarColor, this.mNavigationBarColor, this.mNavigationBarDividerColor);
}
}
}

View File

@@ -0,0 +1,71 @@
package androidx.browser.customtabs;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Dimension;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public class CustomTabsCallback {
public static final int ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET = 1;
public static final int ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED = 2;
public static final int ACTIVITY_LAYOUT_STATE_FULL_SCREEN = 5;
public static final int ACTIVITY_LAYOUT_STATE_SIDE_SHEET = 3;
public static final int ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED = 4;
public static final int ACTIVITY_LAYOUT_STATE_UNKNOWN = 0;
public static final int NAVIGATION_ABORTED = 4;
public static final int NAVIGATION_FAILED = 3;
public static final int NAVIGATION_FINISHED = 2;
public static final int NAVIGATION_STARTED = 1;
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static final String ONLINE_EXTRAS_KEY = "online";
public static final int TAB_HIDDEN = 6;
public static final int TAB_SHOWN = 5;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ActivityLayoutState {
}
public void extraCallback(@NonNull String str, @Nullable Bundle bundle) {
}
@Nullable
public Bundle extraCallbackWithResult(@NonNull String str, @Nullable Bundle bundle) {
return null;
}
public void onActivityLayout(@Dimension(unit = 1) int i, @Dimension(unit = 1) int i2, @Dimension(unit = 1) int i3, @Dimension(unit = 1) int i4, int i5, @NonNull Bundle bundle) {
}
public void onActivityResized(@Dimension(unit = 1) int i, @Dimension(unit = 1) int i2, @NonNull Bundle bundle) {
}
public void onMessageChannelReady(@Nullable Bundle bundle) {
}
@ExperimentalMinimizationCallback
public void onMinimized(@NonNull Bundle bundle) {
}
public void onNavigationEvent(int i, @Nullable Bundle bundle) {
}
public void onPostMessage(@NonNull String str, @Nullable Bundle bundle) {
}
public void onRelationshipValidationResult(int i, @NonNull Uri uri, boolean z, @Nullable Bundle bundle) {
}
@ExperimentalMinimizationCallback
public void onUnminimized(@NonNull Bundle bundle) {
}
public void onWarmupCompleted(@NonNull Bundle bundle) {
}
}

View File

@@ -0,0 +1,322 @@
package androidx.browser.customtabs;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.support.customtabs.ICustomTabsService;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.browser.customtabs.CustomTabsSession;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class CustomTabsClient {
private static final String TAG = "CustomTabsClient";
private final Context mApplicationContext;
private final ICustomTabsService mService;
private final ComponentName mServiceComponentName;
public CustomTabsClient(ICustomTabsService iCustomTabsService, ComponentName componentName, Context context) {
this.mService = iCustomTabsService;
this.mServiceComponentName = componentName;
this.mApplicationContext = context;
}
public static boolean bindCustomTabsService(@NonNull Context context, @Nullable String str, @NonNull CustomTabsServiceConnection customTabsServiceConnection) {
customTabsServiceConnection.setApplicationContext(context.getApplicationContext());
Intent intent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
if (!TextUtils.isEmpty(str)) {
intent.setPackage(str);
}
return context.bindService(intent, customTabsServiceConnection, 33);
}
public static boolean bindCustomTabsServicePreservePriority(@NonNull Context context, @Nullable String str, @NonNull CustomTabsServiceConnection customTabsServiceConnection) {
customTabsServiceConnection.setApplicationContext(context.getApplicationContext());
Intent intent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
if (!TextUtils.isEmpty(str)) {
intent.setPackage(str);
}
return context.bindService(intent, customTabsServiceConnection, 1);
}
@Nullable
public static String getPackageName(@NonNull Context context, @Nullable List<String> list) {
return getPackageName(context, list, false);
}
@Nullable
public static String getPackageName(@NonNull Context context, @Nullable List<String> list, boolean z) {
ResolveInfo resolveActivity;
PackageManager packageManager = context.getPackageManager();
List<String> arrayList = list == null ? new ArrayList<>() : list;
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://"));
if (!z && (resolveActivity = packageManager.resolveActivity(intent, 0)) != null) {
String str = resolveActivity.activityInfo.packageName;
ArrayList arrayList2 = new ArrayList(arrayList.size() + 1);
arrayList2.add(str);
if (list != null) {
arrayList2.addAll(list);
}
arrayList = arrayList2;
}
Intent intent2 = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
for (String str2 : arrayList) {
intent2.setPackage(str2);
if (packageManager.resolveService(intent2, 0) != null) {
return str2;
}
}
if (Build.VERSION.SDK_INT < 30) {
return null;
}
Log.w(TAG, "Unable to find any Custom Tabs packages, you may need to add a <queries> element to your manifest. See the docs for CustomTabsClient#getPackageName.");
return null;
}
public static boolean connectAndInitialize(@NonNull Context context, @NonNull String str) {
if (str == null) {
return false;
}
final Context applicationContext = context.getApplicationContext();
try {
return bindCustomTabsService(applicationContext, str, new CustomTabsServiceConnection() { // from class: androidx.browser.customtabs.CustomTabsClient.1
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
}
@Override // androidx.browser.customtabs.CustomTabsServiceConnection
public final void onCustomTabsServiceConnected(@NonNull ComponentName componentName, @NonNull CustomTabsClient customTabsClient) {
customTabsClient.warmup(0L);
applicationContext.unbindService(this);
}
});
} catch (SecurityException unused) {
return false;
}
}
public boolean warmup(long j) {
try {
return this.mService.warmup(j);
} catch (RemoteException unused) {
return false;
}
}
private static PendingIntent createSessionId(Context context, int i) {
return PendingIntent.getActivity(context, i, new Intent(), AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL);
}
@Nullable
public CustomTabsSession newSession(@Nullable CustomTabsCallback customTabsCallback) {
return newSessionInternal(customTabsCallback, null);
}
@Nullable
public CustomTabsSession newSession(@Nullable CustomTabsCallback customTabsCallback, int i) {
return newSessionInternal(customTabsCallback, createSessionId(this.mApplicationContext, i));
}
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static CustomTabsSession.PendingSession newPendingSession(@NonNull Context context, @Nullable CustomTabsCallback customTabsCallback, int i) {
return new CustomTabsSession.PendingSession(customTabsCallback, createSessionId(context, i));
}
@Nullable
private CustomTabsSession newSessionInternal(@Nullable CustomTabsCallback customTabsCallback, @Nullable PendingIntent pendingIntent) {
boolean newSession;
ICustomTabsCallback.Stub createCallbackWrapper = createCallbackWrapper(customTabsCallback);
try {
if (pendingIntent != null) {
Bundle bundle = new Bundle();
bundle.putParcelable(CustomTabsIntent.EXTRA_SESSION_ID, pendingIntent);
newSession = this.mService.newSessionWithExtras(createCallbackWrapper, bundle);
} else {
newSession = this.mService.newSession(createCallbackWrapper);
}
if (newSession) {
return new CustomTabsSession(this.mService, createCallbackWrapper, this.mServiceComponentName, pendingIntent);
}
return null;
} catch (RemoteException unused) {
return null;
}
}
@Nullable
public Bundle extraCommand(@NonNull String str, @Nullable Bundle bundle) {
try {
return this.mService.extraCommand(str, bundle);
} catch (RemoteException unused) {
return null;
}
}
private ICustomTabsCallback.Stub createCallbackWrapper(@Nullable final CustomTabsCallback customTabsCallback) {
return new ICustomTabsCallback.Stub() { // from class: androidx.browser.customtabs.CustomTabsClient.2
private Handler mHandler = new Handler(Looper.getMainLooper());
@Override // android.support.customtabs.ICustomTabsCallback
public void onNavigationEvent(final int i, final Bundle bundle) {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.1
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onNavigationEvent(i, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void extraCallback(final String str, final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.2
@Override // java.lang.Runnable
public void run() {
customTabsCallback.extraCallback(str, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public Bundle extraCallbackWithResult(@NonNull String str, @Nullable Bundle bundle) throws RemoteException {
CustomTabsCallback customTabsCallback2 = customTabsCallback;
if (customTabsCallback2 == null) {
return null;
}
return customTabsCallback2.extraCallbackWithResult(str, bundle);
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onMessageChannelReady(final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.3
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onMessageChannelReady(bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onPostMessage(final String str, final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.4
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onPostMessage(str, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onRelationshipValidationResult(final int i, final Uri uri, final boolean z, @Nullable final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.5
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onRelationshipValidationResult(i, uri, z, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onActivityResized(final int i, final int i2, @Nullable final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.6
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onActivityResized(i, i2, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onWarmupCompleted(@NonNull final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.7
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onWarmupCompleted(bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onActivityLayout(final int i, final int i2, final int i3, final int i4, final int i5, @NonNull final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.8
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onActivityLayout(i, i2, i3, i4, i5, bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onMinimized(@NonNull final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.9
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onMinimized(bundle);
}
});
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onUnminimized(@NonNull final Bundle bundle) throws RemoteException {
if (customTabsCallback == null) {
return;
}
this.mHandler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsClient.2.10
@Override // java.lang.Runnable
public void run() {
customTabsCallback.onUnminimized(bundle);
}
});
}
};
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY})
public CustomTabsSession attachSession(@NonNull CustomTabsSession.PendingSession pendingSession) {
return newSessionInternal(pendingSession.getCallback(), pendingSession.getId());
}
}

View File

@@ -0,0 +1,22 @@
package androidx.browser.customtabs;
import androidx.annotation.RestrictTo;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public class CustomTabsFeatures {
public static final String ENGAGEMENT_SIGNALS = "ENGAGEMENT_SIGNALS";
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface CustomTabsFeature {
}
private CustomTabsFeatures() {
}
}

View File

@@ -0,0 +1,771 @@
package androidx.browser.customtabs;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.LocaleList;
import android.text.TextUtils;
import android.util.SparseArray;
import android.widget.RemoteViews;
import androidx.annotation.AnimRes;
import androidx.annotation.ColorInt;
import androidx.annotation.Dimension;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsSession;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat;
import com.google.android.gms.drive.DriveFile;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Locale;
/* loaded from: classes.dex */
public final class CustomTabsIntent {
public static final int ACTIVITY_HEIGHT_ADJUSTABLE = 1;
public static final int ACTIVITY_HEIGHT_DEFAULT = 0;
public static final int ACTIVITY_HEIGHT_FIXED = 2;
private static final int ACTIVITY_HEIGHT_MAX = 2;
public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT = 0;
public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER = 3;
private static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_MAX = 3;
public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE = 1;
public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW = 2;
public static final int ACTIVITY_SIDE_SHEET_POSITION_DEFAULT = 0;
public static final int ACTIVITY_SIDE_SHEET_POSITION_END = 2;
private static final int ACTIVITY_SIDE_SHEET_POSITION_MAX = 2;
public static final int ACTIVITY_SIDE_SHEET_POSITION_START = 1;
public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_DEFAULT = 0;
private static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_MAX = 2;
public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE = 1;
public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP = 2;
public static final int CLOSE_BUTTON_POSITION_DEFAULT = 0;
public static final int CLOSE_BUTTON_POSITION_END = 2;
private static final int CLOSE_BUTTON_POSITION_MAX = 2;
public static final int CLOSE_BUTTON_POSITION_START = 1;
public static final int COLOR_SCHEME_DARK = 2;
public static final int COLOR_SCHEME_LIGHT = 1;
private static final int COLOR_SCHEME_MAX = 2;
public static final int COLOR_SCHEME_SYSTEM = 0;
public static final String EXTRA_ACTION_BUTTON_BUNDLE = "android.support.customtabs.extra.ACTION_BUTTON_BUNDLE";
public static final String EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR = "androidx.browser.customtabs.extra.ACTIVITY_HEIGHT_RESIZE_BEHAVIOR";
public static final String EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP = "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_BREAKPOINT_DP";
public static final String EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE = "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_DECORATION_TYPE";
public static final String EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION = "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION";
public static final String EXTRA_ACTIVITY_SIDE_SHEET_POSITION = "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_POSITION";
public static final String EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION = "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION";
public static final String EXTRA_CLOSE_BUTTON_ICON = "android.support.customtabs.extra.CLOSE_BUTTON_ICON";
public static final String EXTRA_CLOSE_BUTTON_POSITION = "androidx.browser.customtabs.extra.CLOSE_BUTTON_POSITION";
public static final String EXTRA_COLOR_SCHEME = "androidx.browser.customtabs.extra.COLOR_SCHEME";
public static final String EXTRA_COLOR_SCHEME_PARAMS = "androidx.browser.customtabs.extra.COLOR_SCHEME_PARAMS";
@Deprecated
public static final String EXTRA_DEFAULT_SHARE_MENU_ITEM = "android.support.customtabs.extra.SHARE_MENU_ITEM";
public static final String EXTRA_DISABLE_BACKGROUND_INTERACTION = "androidx.browser.customtabs.extra.DISABLE_BACKGROUND_INTERACTION";
public static final String EXTRA_DISABLE_BOOKMARKS_BUTTON = "org.chromium.chrome.browser.customtabs.EXTRA_DISABLE_STAR_BUTTON";
public static final String EXTRA_DISABLE_DOWNLOAD_BUTTON = "org.chromium.chrome.browser.customtabs.EXTRA_DISABLE_DOWNLOAD_BUTTON";
public static final String EXTRA_ENABLE_INSTANT_APPS = "android.support.customtabs.extra.EXTRA_ENABLE_INSTANT_APPS";
public static final String EXTRA_ENABLE_URLBAR_HIDING = "android.support.customtabs.extra.ENABLE_URLBAR_HIDING";
public static final String EXTRA_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
public static final String EXTRA_INITIAL_ACTIVITY_HEIGHT_PX = "androidx.browser.customtabs.extra.INITIAL_ACTIVITY_HEIGHT_PX";
public static final String EXTRA_INITIAL_ACTIVITY_WIDTH_PX = "androidx.browser.customtabs.extra.INITIAL_ACTIVITY_WIDTH_PX";
public static final String EXTRA_MENU_ITEMS = "android.support.customtabs.extra.MENU_ITEMS";
public static final String EXTRA_NAVIGATION_BAR_COLOR = "androidx.browser.customtabs.extra.NAVIGATION_BAR_COLOR";
public static final String EXTRA_NAVIGATION_BAR_DIVIDER_COLOR = "androidx.browser.customtabs.extra.NAVIGATION_BAR_DIVIDER_COLOR";
public static final String EXTRA_REMOTEVIEWS = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS";
public static final String EXTRA_REMOTEVIEWS_CLICKED_ID = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_CLICKED_ID";
public static final String EXTRA_REMOTEVIEWS_PENDINGINTENT = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_PENDINGINTENT";
public static final String EXTRA_REMOTEVIEWS_VIEW_IDS = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_VIEW_IDS";
public static final String EXTRA_SECONDARY_TOOLBAR_COLOR = "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR";
public static final String EXTRA_SECONDARY_TOOLBAR_SWIPE_UP_GESTURE = "androidx.browser.customtabs.extra.SECONDARY_TOOLBAR_SWIPE_UP_GESTURE";
public static final String EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER = "android.support.customtabs.extra.SEND_TO_EXTERNAL_HANDLER";
public static final String EXTRA_SESSION = "android.support.customtabs.extra.SESSION";
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static final String EXTRA_SESSION_ID = "android.support.customtabs.extra.SESSION_ID";
public static final String EXTRA_SHARE_STATE = "androidx.browser.customtabs.extra.SHARE_STATE";
public static final String EXTRA_TINT_ACTION_BUTTON = "android.support.customtabs.extra.TINT_ACTION_BUTTON";
public static final String EXTRA_TITLE_VISIBILITY_STATE = "android.support.customtabs.extra.TITLE_VISIBILITY";
public static final String EXTRA_TOOLBAR_COLOR = "android.support.customtabs.extra.TOOLBAR_COLOR";
public static final String EXTRA_TOOLBAR_CORNER_RADIUS_DP = "androidx.browser.customtabs.extra.TOOLBAR_CORNER_RADIUS_DP";
public static final String EXTRA_TOOLBAR_ITEMS = "android.support.customtabs.extra.TOOLBAR_ITEMS";
public static final String EXTRA_TRANSLATE_LANGUAGE_TAG = "androidx.browser.customtabs.extra.TRANSLATE_LANGUAGE_TAG";
private static final String EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS = "android.support.customtabs.extra.user_opt_out";
private static final String HTTP_ACCEPT_LANGUAGE = "Accept-Language";
public static final String KEY_DESCRIPTION = "android.support.customtabs.customaction.DESCRIPTION";
public static final String KEY_ICON = "android.support.customtabs.customaction.ICON";
public static final String KEY_ID = "android.support.customtabs.customaction.ID";
public static final String KEY_MENU_ITEM_TITLE = "android.support.customtabs.customaction.MENU_ITEM_TITLE";
public static final String KEY_PENDING_INTENT = "android.support.customtabs.customaction.PENDING_INTENT";
private static final int MAX_TOOLBAR_CORNER_RADIUS_DP = 16;
private static final int MAX_TOOLBAR_ITEMS = 5;
public static final int NO_TITLE = 0;
public static final int SHARE_STATE_DEFAULT = 0;
private static final int SHARE_STATE_MAX = 2;
public static final int SHARE_STATE_OFF = 2;
public static final int SHARE_STATE_ON = 1;
public static final int SHOW_PAGE_TITLE = 1;
public static final int TOOLBAR_ACTION_BUTTON_ID = 0;
@NonNull
public final Intent intent;
@Nullable
public final Bundle startAnimationBundle;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ActivityHeightResizeBehavior {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ActivitySideSheetDecorationType {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ActivitySideSheetPosition {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ActivitySideSheetRoundedCornersPosition {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface CloseButtonPosition {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ColorScheme {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ShareState {
}
public static int getMaxToolbarItems() {
return 5;
}
public void launchUrl(@NonNull Context context, @NonNull Uri uri) {
this.intent.setData(uri);
ContextCompat.startActivity(context, this.intent, this.startAnimationBundle);
}
public CustomTabsIntent(@NonNull Intent intent, @Nullable Bundle bundle) {
this.intent = intent;
this.startAnimationBundle = bundle;
}
public static final class Builder {
@Nullable
private ArrayList<Bundle> mActionButtons;
@Nullable
private ActivityOptions mActivityOptions;
@Nullable
private SparseArray<Bundle> mColorSchemeParamBundles;
@Nullable
private Bundle mDefaultColorSchemeBundle;
@Nullable
private ArrayList<Bundle> mMenuItems;
private boolean mShareIdentity;
private final Intent mIntent = new Intent("android.intent.action.VIEW");
private final CustomTabColorSchemeParams.Builder mDefaultColorSchemeBuilder = new CustomTabColorSchemeParams.Builder();
private int mShareState = 0;
private boolean mInstantAppsEnabled = true;
@NonNull
public Builder setInstantAppsEnabled(boolean z) {
this.mInstantAppsEnabled = z;
return this;
}
@NonNull
public Builder setShareIdentityEnabled(boolean z) {
this.mShareIdentity = z;
return this;
}
public Builder() {
}
public Builder(@Nullable CustomTabsSession customTabsSession) {
if (customTabsSession != null) {
setSession(customTabsSession);
}
}
@NonNull
public Builder setSession(@NonNull CustomTabsSession customTabsSession) {
this.mIntent.setPackage(customTabsSession.getComponentName().getPackageName());
setSessionParameters(customTabsSession.getBinder(), customTabsSession.getId());
return this;
}
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public Builder setPendingSession(@NonNull CustomTabsSession.PendingSession pendingSession) {
setSessionParameters(null, pendingSession.getId());
return this;
}
private void setSessionParameters(@Nullable IBinder iBinder, @Nullable PendingIntent pendingIntent) {
Bundle bundle = new Bundle();
bundle.putBinder(CustomTabsIntent.EXTRA_SESSION, iBinder);
if (pendingIntent != null) {
bundle.putParcelable(CustomTabsIntent.EXTRA_SESSION_ID, pendingIntent);
}
this.mIntent.putExtras(bundle);
}
@NonNull
@Deprecated
public Builder setToolbarColor(@ColorInt int i) {
this.mDefaultColorSchemeBuilder.setToolbarColor(i);
return this;
}
@NonNull
@Deprecated
public Builder enableUrlBarHiding() {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ENABLE_URLBAR_HIDING, true);
return this;
}
@NonNull
public Builder setUrlBarHidingEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ENABLE_URLBAR_HIDING, z);
return this;
}
@NonNull
public Builder setCloseButtonIcon(@NonNull Bitmap bitmap) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_CLOSE_BUTTON_ICON, bitmap);
return this;
}
@NonNull
public Builder setShowTitle(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, z ? 1 : 0);
return this;
}
@NonNull
public Builder addMenuItem(@NonNull String str, @NonNull PendingIntent pendingIntent) {
if (this.mMenuItems == null) {
this.mMenuItems = new ArrayList<>();
}
Bundle bundle = new Bundle();
bundle.putString(CustomTabsIntent.KEY_MENU_ITEM_TITLE, str);
bundle.putParcelable(CustomTabsIntent.KEY_PENDING_INTENT, pendingIntent);
this.mMenuItems.add(bundle);
return this;
}
@NonNull
@Deprecated
public Builder addDefaultShareMenuItem() {
setShareState(1);
return this;
}
@NonNull
@Deprecated
public Builder setDefaultShareMenuItemEnabled(boolean z) {
if (z) {
setShareState(1);
} else {
setShareState(2);
}
return this;
}
@NonNull
public Builder setShareState(int i) {
if (i < 0 || i > 2) {
throw new IllegalArgumentException("Invalid value for the shareState argument");
}
this.mShareState = i;
if (i == 1) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, true);
} else if (i == 2) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, false);
} else {
this.mIntent.removeExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM);
}
return this;
}
@NonNull
public Builder setActionButton(@NonNull Bitmap bitmap, @NonNull String str, @NonNull PendingIntent pendingIntent, boolean z) {
Bundle bundle = new Bundle();
bundle.putInt(CustomTabsIntent.KEY_ID, 0);
bundle.putParcelable(CustomTabsIntent.KEY_ICON, bitmap);
bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, str);
bundle.putParcelable(CustomTabsIntent.KEY_PENDING_INTENT, pendingIntent);
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle);
this.mIntent.putExtra(CustomTabsIntent.EXTRA_TINT_ACTION_BUTTON, z);
return this;
}
@NonNull
public Builder setActionButton(@NonNull Bitmap bitmap, @NonNull String str, @NonNull PendingIntent pendingIntent) {
return setActionButton(bitmap, str, pendingIntent, false);
}
@NonNull
@Deprecated
public Builder addToolbarItem(int i, @NonNull Bitmap bitmap, @NonNull String str, @NonNull PendingIntent pendingIntent) throws IllegalStateException {
if (this.mActionButtons == null) {
this.mActionButtons = new ArrayList<>();
}
if (this.mActionButtons.size() >= 5) {
throw new IllegalStateException("Exceeded maximum toolbar item count of 5");
}
Bundle bundle = new Bundle();
bundle.putInt(CustomTabsIntent.KEY_ID, i);
bundle.putParcelable(CustomTabsIntent.KEY_ICON, bitmap);
bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, str);
bundle.putParcelable(CustomTabsIntent.KEY_PENDING_INTENT, pendingIntent);
this.mActionButtons.add(bundle);
return this;
}
@NonNull
@Deprecated
public Builder setSecondaryToolbarColor(@ColorInt int i) {
this.mDefaultColorSchemeBuilder.setSecondaryToolbarColor(i);
return this;
}
@NonNull
@Deprecated
public Builder setNavigationBarColor(@ColorInt int i) {
this.mDefaultColorSchemeBuilder.setNavigationBarColor(i);
return this;
}
@NonNull
@Deprecated
public Builder setNavigationBarDividerColor(@ColorInt int i) {
this.mDefaultColorSchemeBuilder.setNavigationBarDividerColor(i);
return this;
}
@NonNull
public Builder setSecondaryToolbarViews(@NonNull RemoteViews remoteViews, @Nullable int[] iArr, @Nullable PendingIntent pendingIntent) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_REMOTEVIEWS, remoteViews);
this.mIntent.putExtra(CustomTabsIntent.EXTRA_REMOTEVIEWS_VIEW_IDS, iArr);
this.mIntent.putExtra(CustomTabsIntent.EXTRA_REMOTEVIEWS_PENDINGINTENT, pendingIntent);
return this;
}
@NonNull
public Builder setSecondaryToolbarSwipeUpGesture(@Nullable PendingIntent pendingIntent) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_SECONDARY_TOOLBAR_SWIPE_UP_GESTURE, pendingIntent);
return this;
}
@NonNull
public Builder setStartAnimations(@NonNull Context context, @AnimRes int i, @AnimRes int i2) {
this.mActivityOptions = ActivityOptions.makeCustomAnimation(context, i, i2);
return this;
}
@NonNull
public Builder setExitAnimations(@NonNull Context context, @AnimRes int i, @AnimRes int i2) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_EXIT_ANIMATION_BUNDLE, ActivityOptionsCompat.makeCustomAnimation(context, i, i2).toBundle());
return this;
}
@NonNull
public Builder setColorScheme(int i) {
if (i < 0 || i > 2) {
throw new IllegalArgumentException("Invalid value for the colorScheme argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_COLOR_SCHEME, i);
return this;
}
@NonNull
public Builder setColorSchemeParams(int i, @NonNull CustomTabColorSchemeParams customTabColorSchemeParams) {
if (i < 0 || i > 2 || i == 0) {
throw new IllegalArgumentException("Invalid colorScheme: " + i);
}
if (this.mColorSchemeParamBundles == null) {
this.mColorSchemeParamBundles = new SparseArray<>();
}
this.mColorSchemeParamBundles.put(i, customTabColorSchemeParams.toBundle());
return this;
}
@NonNull
public Builder setDefaultColorSchemeParams(@NonNull CustomTabColorSchemeParams customTabColorSchemeParams) {
this.mDefaultColorSchemeBundle = customTabColorSchemeParams.toBundle();
return this;
}
@NonNull
public Builder setInitialActivityHeightPx(@Dimension(unit = 1) int i, int i2) {
if (i <= 0) {
throw new IllegalArgumentException("Invalid value for the initialHeightPx argument");
}
if (i2 < 0 || i2 > 2) {
throw new IllegalArgumentException("Invalid value for the activityHeightResizeBehavior argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_HEIGHT_PX, i);
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR, i2);
return this;
}
@NonNull
public Builder setInitialActivityHeightPx(@Dimension(unit = 1) int i) {
return setInitialActivityHeightPx(i, 0);
}
@NonNull
public Builder setInitialActivityWidthPx(@Dimension(unit = 1) int i) {
if (i <= 0) {
throw new IllegalArgumentException("Invalid value for the initialWidthPx argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, i);
return this;
}
@NonNull
public Builder setActivitySideSheetBreakpointDp(@Dimension(unit = 0) int i) {
if (i <= 0) {
throw new IllegalArgumentException("Invalid value for the initialWidthPx argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, i);
return this;
}
@NonNull
public Builder setActivitySideSheetMaximizationEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION, z);
return this;
}
@NonNull
public Builder setActivitySideSheetPosition(int i) {
if (i < 0 || i > 2) {
throw new IllegalArgumentException("Invalid value for the sideSheetPosition argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, i);
return this;
}
@NonNull
public Builder setActivitySideSheetDecorationType(int i) {
if (i < 0 || i > 3) {
throw new IllegalArgumentException("Invalid value for the decorationType argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, i);
return this;
}
@NonNull
public Builder setActivitySideSheetRoundedCornersPosition(int i) {
if (i < 0 || i > 2) {
throw new IllegalArgumentException("Invalid value for the roundedCornersPosition./ argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, i);
return this;
}
@NonNull
public Builder setToolbarCornerRadiusDp(@Dimension(unit = 0) int i) {
if (i < 0 || i > 16) {
throw new IllegalArgumentException("Invalid value for the cornerRadiusDp argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_TOOLBAR_CORNER_RADIUS_DP, i);
return this;
}
@NonNull
public Builder setCloseButtonPosition(int i) {
if (i < 0 || i > 2) {
throw new IllegalArgumentException("Invalid value for the position argument");
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_CLOSE_BUTTON_POSITION, i);
return this;
}
@NonNull
public Builder setBookmarksButtonEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_DISABLE_BOOKMARKS_BUTTON, !z);
return this;
}
@NonNull
public Builder setDownloadButtonEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_DISABLE_DOWNLOAD_BUTTON, !z);
return this;
}
@NonNull
public Builder setSendToExternalDefaultHandlerEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, z);
return this;
}
@NonNull
public Builder setTranslateLocale(@NonNull Locale locale) {
setLanguageTag(locale);
return this;
}
@NonNull
public Builder setBackgroundInteractionEnabled(boolean z) {
this.mIntent.putExtra(CustomTabsIntent.EXTRA_DISABLE_BACKGROUND_INTERACTION, !z);
return this;
}
@NonNull
public CustomTabsIntent build() {
if (!this.mIntent.hasExtra(CustomTabsIntent.EXTRA_SESSION)) {
setSessionParameters(null, null);
}
ArrayList<Bundle> arrayList = this.mMenuItems;
if (arrayList != null) {
this.mIntent.putParcelableArrayListExtra(CustomTabsIntent.EXTRA_MENU_ITEMS, arrayList);
}
ArrayList<Bundle> arrayList2 = this.mActionButtons;
if (arrayList2 != null) {
this.mIntent.putParcelableArrayListExtra(CustomTabsIntent.EXTRA_TOOLBAR_ITEMS, arrayList2);
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_ENABLE_INSTANT_APPS, this.mInstantAppsEnabled);
this.mIntent.putExtras(this.mDefaultColorSchemeBuilder.build().toBundle());
Bundle bundle = this.mDefaultColorSchemeBundle;
if (bundle != null) {
this.mIntent.putExtras(bundle);
}
if (this.mColorSchemeParamBundles != null) {
Bundle bundle2 = new Bundle();
bundle2.putSparseParcelableArray(CustomTabsIntent.EXTRA_COLOR_SCHEME_PARAMS, this.mColorSchemeParamBundles);
this.mIntent.putExtras(bundle2);
}
this.mIntent.putExtra(CustomTabsIntent.EXTRA_SHARE_STATE, this.mShareState);
int i = Build.VERSION.SDK_INT;
setCurrentLocaleAsDefaultAcceptLanguage();
if (i >= 34) {
setShareIdentityEnabled();
}
ActivityOptions activityOptions = this.mActivityOptions;
return new CustomTabsIntent(this.mIntent, activityOptions != null ? activityOptions.toBundle() : null);
}
@RequiresApi(api = 24)
private void setCurrentLocaleAsDefaultAcceptLanguage() {
String defaultLocale = Api24Impl.getDefaultLocale();
if (TextUtils.isEmpty(defaultLocale)) {
return;
}
Bundle bundleExtra = this.mIntent.hasExtra("com.android.browser.headers") ? this.mIntent.getBundleExtra("com.android.browser.headers") : new Bundle();
if (bundleExtra.containsKey(CustomTabsIntent.HTTP_ACCEPT_LANGUAGE)) {
return;
}
bundleExtra.putString(CustomTabsIntent.HTTP_ACCEPT_LANGUAGE, defaultLocale);
this.mIntent.putExtra("com.android.browser.headers", bundleExtra);
}
@RequiresApi(api = 24)
private void setLanguageTag(@NonNull Locale locale) {
Api21Impl.setLanguageTag(this.mIntent, locale);
}
@RequiresApi(api = 34)
private void setShareIdentityEnabled() {
if (this.mActivityOptions == null) {
this.mActivityOptions = Api23Impl.makeBasicActivityOptions();
}
Api34Impl.setShareIdentityEnabled(this.mActivityOptions, this.mShareIdentity);
}
}
@NonNull
public static Intent setAlwaysUseBrowserUI(@Nullable Intent intent) {
if (intent == null) {
intent = new Intent("android.intent.action.VIEW");
}
intent.addFlags(DriveFile.MODE_READ_ONLY);
intent.putExtra(EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS, true);
return intent;
}
public static boolean shouldAlwaysUseBrowserUI(@NonNull Intent intent) {
return intent.getBooleanExtra(EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS, false) && (intent.getFlags() & DriveFile.MODE_READ_ONLY) != 0;
}
@NonNull
public static CustomTabColorSchemeParams getColorSchemeParams(@NonNull Intent intent, int i) {
Bundle bundle;
if (i < 0 || i > 2 || i == 0) {
throw new IllegalArgumentException("Invalid colorScheme: " + i);
}
Bundle extras = intent.getExtras();
if (extras == null) {
return CustomTabColorSchemeParams.fromBundle(null);
}
CustomTabColorSchemeParams fromBundle = CustomTabColorSchemeParams.fromBundle(extras);
SparseArray sparseParcelableArray = extras.getSparseParcelableArray(EXTRA_COLOR_SCHEME_PARAMS);
return (sparseParcelableArray == null || (bundle = (Bundle) sparseParcelableArray.get(i)) == null) ? fromBundle : CustomTabColorSchemeParams.fromBundle(bundle).withDefaults(fromBundle);
}
public static int getActivityResizeBehavior(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR, 0);
}
@Dimension(unit = 1)
public static int getInitialActivityHeightPx(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_INITIAL_ACTIVITY_HEIGHT_PX, 0);
}
@Dimension(unit = 1)
public static int getInitialActivityWidthPx(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 0);
}
@Dimension(unit = 0)
public static int getActivitySideSheetBreakpointDp(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 0);
}
public static boolean isActivitySideSheetMaximizationEnabled(@NonNull Intent intent) {
return intent.getBooleanExtra(EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION, false);
}
public static int getActivitySideSheetPosition(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_ACTIVITY_SIDE_SHEET_POSITION, 0);
}
public static int getActivitySideSheetDecorationType(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, 0);
}
public static int getActivitySideSheetRoundedCornersPosition(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, 0);
}
@Dimension(unit = 0)
public static int getToolbarCornerRadiusDp(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_TOOLBAR_CORNER_RADIUS_DP, 16);
}
public static int getCloseButtonPosition(@NonNull Intent intent) {
return intent.getIntExtra(EXTRA_CLOSE_BUTTON_POSITION, 0);
}
public static boolean isBookmarksButtonEnabled(@NonNull Intent intent) {
return !intent.getBooleanExtra(EXTRA_DISABLE_BOOKMARKS_BUTTON, false);
}
public static boolean isDownloadButtonEnabled(@NonNull Intent intent) {
return !intent.getBooleanExtra(EXTRA_DISABLE_DOWNLOAD_BUTTON, false);
}
public static boolean isSendToExternalDefaultHandlerEnabled(@NonNull Intent intent) {
return intent.getBooleanExtra(EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, false);
}
@Nullable
public static Locale getTranslateLocale(@NonNull Intent intent) {
return getLocaleForLanguageTag(intent);
}
@Nullable
@RequiresApi(api = 24)
private static Locale getLocaleForLanguageTag(Intent intent) {
return Api21Impl.getLocaleForLanguageTag(intent);
}
public static boolean isBackgroundInteractionEnabled(@NonNull Intent intent) {
return !intent.getBooleanExtra(EXTRA_DISABLE_BACKGROUND_INTERACTION, false);
}
@Nullable
public static PendingIntent getSecondaryToolbarSwipeUpGesture(@NonNull Intent intent) {
return (PendingIntent) intent.getParcelableExtra(EXTRA_SECONDARY_TOOLBAR_SWIPE_UP_GESTURE);
}
@RequiresApi(api = 21)
public static class Api21Impl {
private Api21Impl() {
}
@DoNotInline
public static void setLanguageTag(Intent intent, Locale locale) {
intent.putExtra(CustomTabsIntent.EXTRA_TRANSLATE_LANGUAGE_TAG, locale.toLanguageTag());
}
@Nullable
@DoNotInline
public static Locale getLocaleForLanguageTag(Intent intent) {
String stringExtra = intent.getStringExtra(CustomTabsIntent.EXTRA_TRANSLATE_LANGUAGE_TAG);
if (stringExtra != null) {
return Locale.forLanguageTag(stringExtra);
}
return null;
}
}
@RequiresApi(api = 23)
public static class Api23Impl {
private Api23Impl() {
}
@DoNotInline
public static ActivityOptions makeBasicActivityOptions() {
return ActivityOptions.makeBasic();
}
}
@RequiresApi(api = 24)
public static class Api24Impl {
private Api24Impl() {
}
@Nullable
@DoNotInline
public static String getDefaultLocale() {
LocaleList adjustedDefault = LocaleList.getAdjustedDefault();
if (adjustedDefault.size() > 0) {
return adjustedDefault.get(0).toLanguageTag();
}
return null;
}
}
@RequiresApi(api = 34)
public static class Api34Impl {
private Api34Impl() {
}
@DoNotInline
public static void setShareIdentityEnabled(ActivityOptions activityOptions, boolean z) {
activityOptions.setShareIdentityEnabled(z);
}
}
}

View File

@@ -0,0 +1,229 @@
package androidx.browser.customtabs;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.support.customtabs.ICustomTabsService;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.browser.customtabs.CustomTabsService;
import androidx.collection.SimpleArrayMap;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public abstract class CustomTabsService extends Service {
public static final String ACTION_CUSTOM_TABS_CONNECTION = "android.support.customtabs.action.CustomTabsService";
public static final String CATEGORY_COLOR_SCHEME_CUSTOMIZATION = "androidx.browser.customtabs.category.ColorSchemeCustomization";
public static final String CATEGORY_NAVBAR_COLOR_CUSTOMIZATION = "androidx.browser.customtabs.category.NavBarColorCustomization";
public static final String CATEGORY_TRUSTED_WEB_ACTIVITY_IMMERSIVE_MODE = "androidx.browser.trusted.category.ImmersiveMode";
public static final String CATEGORY_WEB_SHARE_TARGET_V2 = "androidx.browser.trusted.category.WebShareTargetV2";
public static final int FILE_PURPOSE_TRUSTED_WEB_ACTIVITY_SPLASH_IMAGE = 1;
public static final String KEY_SUCCESS = "androidx.browser.customtabs.SUCCESS";
public static final String KEY_URL = "android.support.customtabs.otherurls.URL";
public static final int RELATION_HANDLE_ALL_URLS = 2;
public static final int RELATION_USE_AS_ORIGIN = 1;
public static final int RESULT_FAILURE_DISALLOWED = -1;
public static final int RESULT_FAILURE_MESSAGING_ERROR = -3;
public static final int RESULT_FAILURE_REMOTE_ERROR = -2;
public static final int RESULT_SUCCESS = 0;
private static final String TAG = "CustomTabsService";
public static final String TRUSTED_WEB_ACTIVITY_CATEGORY = "androidx.browser.trusted.category.TrustedWebActivities";
final SimpleArrayMap<IBinder, IBinder.DeathRecipient> mDeathRecipientMap = new SimpleArrayMap<>();
private ICustomTabsService.Stub mBinder = new AnonymousClass1();
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface FilePurpose {
}
@Retention(RetentionPolicy.SOURCE)
public @interface Relation {
}
@Retention(RetentionPolicy.SOURCE)
public @interface Result {
}
@Nullable
public abstract Bundle extraCommand(@NonNull String str, @Nullable Bundle bundle);
public boolean isEngagementSignalsApiAvailable(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull Bundle bundle) {
return false;
}
public abstract boolean mayLaunchUrl(@NonNull CustomTabsSessionToken customTabsSessionToken, @Nullable Uri uri, @Nullable Bundle bundle, @Nullable List<Bundle> list);
public abstract boolean newSession(@NonNull CustomTabsSessionToken customTabsSessionToken);
@Override // android.app.Service
@NonNull
public IBinder onBind(@Nullable Intent intent) {
return this.mBinder;
}
public abstract int postMessage(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull String str, @Nullable Bundle bundle);
public abstract boolean receiveFile(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull Uri uri, int i, @Nullable Bundle bundle);
public abstract boolean requestPostMessageChannel(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull Uri uri);
public boolean setEngagementSignalsCallback(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull EngagementSignalsCallback engagementSignalsCallback, @NonNull Bundle bundle) {
return false;
}
public abstract boolean updateVisuals(@NonNull CustomTabsSessionToken customTabsSessionToken, @Nullable Bundle bundle);
public abstract boolean validateRelationship(@NonNull CustomTabsSessionToken customTabsSessionToken, int i, @NonNull Uri uri, @Nullable Bundle bundle);
public abstract boolean warmup(long j);
/* renamed from: androidx.browser.customtabs.CustomTabsService$1, reason: invalid class name */
public class AnonymousClass1 extends ICustomTabsService.Stub {
public AnonymousClass1() {
}
@Override // android.support.customtabs.ICustomTabsService
public boolean warmup(long j) {
return CustomTabsService.this.warmup(j);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean newSession(@NonNull ICustomTabsCallback iCustomTabsCallback) {
return newSessionInternal(iCustomTabsCallback, null);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean newSessionWithExtras(@NonNull ICustomTabsCallback iCustomTabsCallback, @Nullable Bundle bundle) {
return newSessionInternal(iCustomTabsCallback, getSessionIdFromBundle(bundle));
}
private boolean newSessionInternal(@NonNull ICustomTabsCallback iCustomTabsCallback, @Nullable PendingIntent pendingIntent) {
final CustomTabsSessionToken customTabsSessionToken = new CustomTabsSessionToken(iCustomTabsCallback, pendingIntent);
try {
IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() { // from class: androidx.browser.customtabs.CustomTabsService$1$$ExternalSyntheticLambda0
@Override // android.os.IBinder.DeathRecipient
public final void binderDied() {
CustomTabsService.AnonymousClass1.this.lambda$newSessionInternal$0(customTabsSessionToken);
}
};
synchronized (CustomTabsService.this.mDeathRecipientMap) {
iCustomTabsCallback.asBinder().linkToDeath(deathRecipient, 0);
CustomTabsService.this.mDeathRecipientMap.put(iCustomTabsCallback.asBinder(), deathRecipient);
}
return CustomTabsService.this.newSession(customTabsSessionToken);
} catch (RemoteException unused) {
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void lambda$newSessionInternal$0(CustomTabsSessionToken customTabsSessionToken) {
CustomTabsService.this.cleanUpSession(customTabsSessionToken);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean mayLaunchUrl(@Nullable ICustomTabsCallback iCustomTabsCallback, @Nullable Uri uri, @Nullable Bundle bundle, @Nullable List<Bundle> list) {
return CustomTabsService.this.mayLaunchUrl(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), uri, bundle, list);
}
@Override // android.support.customtabs.ICustomTabsService
public Bundle extraCommand(@NonNull String str, @Nullable Bundle bundle) {
return CustomTabsService.this.extraCommand(str, bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean updateVisuals(@NonNull ICustomTabsCallback iCustomTabsCallback, @Nullable Bundle bundle) {
return CustomTabsService.this.updateVisuals(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean requestPostMessageChannel(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull Uri uri) {
return CustomTabsService.this.requestPostMessageChannel(new CustomTabsSessionToken(iCustomTabsCallback, null), uri, null, new Bundle());
}
@Override // android.support.customtabs.ICustomTabsService
public boolean requestPostMessageChannelWithExtras(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull Uri uri, @NonNull Bundle bundle) {
return CustomTabsService.this.requestPostMessageChannel(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), uri, getTargetOriginFromBundle(bundle), bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public int postMessage(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull String str, @Nullable Bundle bundle) {
return CustomTabsService.this.postMessage(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), str, bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean validateRelationship(@NonNull ICustomTabsCallback iCustomTabsCallback, int i, @NonNull Uri uri, @Nullable Bundle bundle) {
return CustomTabsService.this.validateRelationship(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), i, uri, bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean receiveFile(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull Uri uri, int i, @Nullable Bundle bundle) {
return CustomTabsService.this.receiveFile(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), uri, i, bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean isEngagementSignalsApiAvailable(ICustomTabsCallback iCustomTabsCallback, @NonNull Bundle bundle) {
return CustomTabsService.this.isEngagementSignalsApiAvailable(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), bundle);
}
@Override // android.support.customtabs.ICustomTabsService
public boolean setEngagementSignalsCallback(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull IBinder iBinder, @NonNull Bundle bundle) {
return CustomTabsService.this.setEngagementSignalsCallback(new CustomTabsSessionToken(iCustomTabsCallback, getSessionIdFromBundle(bundle)), EngagementSignalsCallbackRemote.fromBinder(iBinder), bundle);
}
@Nullable
private PendingIntent getSessionIdFromBundle(@Nullable Bundle bundle) {
if (bundle == null) {
return null;
}
PendingIntent pendingIntent = (PendingIntent) bundle.getParcelable(CustomTabsIntent.EXTRA_SESSION_ID);
bundle.remove(CustomTabsIntent.EXTRA_SESSION_ID);
return pendingIntent;
}
@Nullable
private Uri getTargetOriginFromBundle(@Nullable Bundle bundle) {
if (bundle == null) {
return null;
}
if (Build.VERSION.SDK_INT >= 33) {
return (Uri) Api33Impl.getParcelable(bundle, "target_origin", Uri.class);
}
return (Uri) bundle.getParcelable("target_origin");
}
}
public boolean cleanUpSession(@NonNull CustomTabsSessionToken customTabsSessionToken) {
try {
synchronized (this.mDeathRecipientMap) {
try {
IBinder callbackBinder = customTabsSessionToken.getCallbackBinder();
if (callbackBinder == null) {
return false;
}
callbackBinder.unlinkToDeath(this.mDeathRecipientMap.get(callbackBinder), 0);
this.mDeathRecipientMap.remove(callbackBinder);
return true;
} catch (Throwable th) {
throw th;
}
}
} catch (NoSuchElementException unused) {
return false;
}
}
public boolean requestPostMessageChannel(@NonNull CustomTabsSessionToken customTabsSessionToken, @NonNull Uri uri, @Nullable Uri uri2, @NonNull Bundle bundle) {
return requestPostMessageChannel(customTabsSessionToken, uri);
}
}

View File

@@ -0,0 +1,39 @@
package androidx.browser.customtabs;
import android.content.ComponentName;
import android.content.Context;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.support.customtabs.ICustomTabsService;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/* loaded from: classes.dex */
public abstract class CustomTabsServiceConnection implements ServiceConnection {
@Nullable
private Context mApplicationContext;
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY})
public Context getApplicationContext() {
return this.mApplicationContext;
}
public abstract void onCustomTabsServiceConnected(@NonNull ComponentName componentName, @NonNull CustomTabsClient customTabsClient);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void setApplicationContext(@NonNull Context context) {
this.mApplicationContext = context;
}
@Override // android.content.ServiceConnection
public final void onServiceConnected(@NonNull ComponentName componentName, @NonNull IBinder iBinder) {
if (this.mApplicationContext == null) {
throw new IllegalStateException("Custom Tabs Service connected before an applicationcontext has been provided.");
}
onCustomTabsServiceConnected(componentName, new CustomTabsClient(ICustomTabsService.Stub.asInterface(iBinder), componentName, this.mApplicationContext) { // from class: androidx.browser.customtabs.CustomTabsServiceConnection.1
});
}
}

View File

@@ -0,0 +1,441 @@
package androidx.browser.customtabs;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.support.customtabs.ICustomTabsService;
import android.support.customtabs.IEngagementSignalsCallback;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.browser.customtabs.CustomTabsSessionToken;
import java.util.List;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
public final class CustomTabsSession {
private static final String TAG = "CustomTabsSession";
static final String TARGET_ORIGIN_KEY = "target_origin";
private final ICustomTabsCallback mCallback;
private final ComponentName mComponentName;
@Nullable
private final PendingIntent mId;
private final Object mLock = new Object();
private final ICustomTabsService mService;
public static class MockSession extends ICustomTabsService.Stub {
@Override // android.support.customtabs.ICustomTabsService
public Bundle extraCommand(String str, Bundle bundle) throws RemoteException {
return null;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean isEngagementSignalsApiAvailable(ICustomTabsCallback iCustomTabsCallback, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean mayLaunchUrl(ICustomTabsCallback iCustomTabsCallback, Uri uri, Bundle bundle, List<Bundle> list) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean newSession(ICustomTabsCallback iCustomTabsCallback) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean newSessionWithExtras(ICustomTabsCallback iCustomTabsCallback, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public int postMessage(ICustomTabsCallback iCustomTabsCallback, String str, Bundle bundle) throws RemoteException {
return 0;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean receiveFile(ICustomTabsCallback iCustomTabsCallback, Uri uri, int i, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean requestPostMessageChannel(ICustomTabsCallback iCustomTabsCallback, Uri uri) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean requestPostMessageChannelWithExtras(ICustomTabsCallback iCustomTabsCallback, Uri uri, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean setEngagementSignalsCallback(ICustomTabsCallback iCustomTabsCallback, IBinder iBinder, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean updateVisuals(ICustomTabsCallback iCustomTabsCallback, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean validateRelationship(ICustomTabsCallback iCustomTabsCallback, int i, Uri uri, Bundle bundle) throws RemoteException {
return false;
}
@Override // android.support.customtabs.ICustomTabsService
public boolean warmup(long j) throws RemoteException {
return false;
}
}
public ComponentName getComponentName() {
return this.mComponentName;
}
@Nullable
public PendingIntent getId() {
return this.mId;
}
@NonNull
@VisibleForTesting
public static CustomTabsSession createMockSessionForTesting(@NonNull ComponentName componentName) {
return new CustomTabsSession(new MockSession(), new CustomTabsSessionToken.MockCallback(), componentName, null);
}
public CustomTabsSession(ICustomTabsService iCustomTabsService, ICustomTabsCallback iCustomTabsCallback, ComponentName componentName, @Nullable PendingIntent pendingIntent) {
this.mService = iCustomTabsService;
this.mCallback = iCustomTabsCallback;
this.mComponentName = componentName;
this.mId = pendingIntent;
}
public boolean mayLaunchUrl(@Nullable Uri uri, @Nullable Bundle bundle, @Nullable List<Bundle> list) {
try {
return this.mService.mayLaunchUrl(this.mCallback, uri, createBundleWithId(bundle), list);
} catch (RemoteException unused) {
return false;
}
}
public boolean setActionButton(@NonNull Bitmap bitmap, @NonNull String str) {
Bundle bundle = new Bundle();
bundle.putParcelable(CustomTabsIntent.KEY_ICON, bitmap);
bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, str);
Bundle bundle2 = new Bundle();
bundle2.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle);
addIdToBundle(bundle);
try {
return this.mService.updateVisuals(this.mCallback, bundle2);
} catch (RemoteException unused) {
return false;
}
}
public boolean setSecondaryToolbarViews(@Nullable RemoteViews remoteViews, @Nullable int[] iArr, @Nullable PendingIntent pendingIntent) {
Bundle bundle = new Bundle();
bundle.putParcelable(CustomTabsIntent.EXTRA_REMOTEVIEWS, remoteViews);
bundle.putIntArray(CustomTabsIntent.EXTRA_REMOTEVIEWS_VIEW_IDS, iArr);
bundle.putParcelable(CustomTabsIntent.EXTRA_REMOTEVIEWS_PENDINGINTENT, pendingIntent);
addIdToBundle(bundle);
try {
return this.mService.updateVisuals(this.mCallback, bundle);
} catch (RemoteException unused) {
return false;
}
}
public boolean setSecondaryToolbarSwipeUpGesture(@Nullable PendingIntent pendingIntent) {
Bundle bundle = new Bundle();
bundle.putParcelable(CustomTabsIntent.EXTRA_SECONDARY_TOOLBAR_SWIPE_UP_GESTURE, pendingIntent);
addIdToBundle(bundle);
try {
return this.mService.updateVisuals(this.mCallback, bundle);
} catch (RemoteException unused) {
return false;
}
}
@Deprecated
public boolean setToolbarItem(int i, @NonNull Bitmap bitmap, @NonNull String str) {
Bundle bundle = new Bundle();
bundle.putInt(CustomTabsIntent.KEY_ID, i);
bundle.putParcelable(CustomTabsIntent.KEY_ICON, bitmap);
bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, str);
Bundle bundle2 = new Bundle();
bundle2.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle);
addIdToBundle(bundle2);
try {
return this.mService.updateVisuals(this.mCallback, bundle2);
} catch (RemoteException unused) {
return false;
}
}
public boolean requestPostMessageChannel(@NonNull Uri uri) {
return requestPostMessageChannel(uri, null, new Bundle());
}
public boolean requestPostMessageChannel(@NonNull Uri uri, @Nullable Uri uri2, @NonNull Bundle bundle) {
try {
Bundle createPostMessageExtraBundle = createPostMessageExtraBundle(uri2);
if (createPostMessageExtraBundle != null) {
bundle.putAll(createPostMessageExtraBundle);
return this.mService.requestPostMessageChannelWithExtras(this.mCallback, uri, bundle);
}
return this.mService.requestPostMessageChannel(this.mCallback, uri);
} catch (RemoteException unused) {
return false;
}
}
public int postMessage(@NonNull String str, @Nullable Bundle bundle) {
int postMessage;
Bundle createBundleWithId = createBundleWithId(bundle);
synchronized (this.mLock) {
try {
try {
postMessage = this.mService.postMessage(this.mCallback, str, createBundleWithId);
} catch (RemoteException unused) {
return -2;
}
} catch (Throwable th) {
throw th;
}
}
return postMessage;
}
public boolean validateRelationship(int i, @NonNull Uri uri, @Nullable Bundle bundle) {
if (i >= 1 && i <= 2) {
try {
return this.mService.validateRelationship(this.mCallback, i, uri, createBundleWithId(bundle));
} catch (RemoteException unused) {
}
}
return false;
}
public boolean receiveFile(@NonNull Uri uri, int i, @Nullable Bundle bundle) {
try {
return this.mService.receiveFile(this.mCallback, uri, i, createBundleWithId(bundle));
} catch (RemoteException unused) {
return false;
}
}
public boolean isEngagementSignalsApiAvailable(@NonNull Bundle bundle) throws RemoteException {
try {
return this.mService.isEngagementSignalsApiAvailable(this.mCallback, createBundleWithId(bundle));
} catch (SecurityException e) {
throw new UnsupportedOperationException("This method isn't supported by the Custom Tabs implementation.", e);
}
}
public boolean setEngagementSignalsCallback(@NonNull EngagementSignalsCallback engagementSignalsCallback, @NonNull Bundle bundle) throws RemoteException {
try {
return this.mService.setEngagementSignalsCallback(this.mCallback, createEngagementSignalsCallbackWrapper(engagementSignalsCallback).asBinder(), createBundleWithId(bundle));
} catch (SecurityException e) {
throw new UnsupportedOperationException("This method isn't supported by the Custom Tabs implementation.", e);
}
}
/* renamed from: androidx.browser.customtabs.CustomTabsSession$1, reason: invalid class name */
public class AnonymousClass1 extends IEngagementSignalsCallback.Stub {
private final Handler mHandler = new Handler(Looper.getMainLooper());
final /* synthetic */ EngagementSignalsCallback val$callback;
public AnonymousClass1(EngagementSignalsCallback engagementSignalsCallback) {
this.val$callback = engagementSignalsCallback;
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onVerticalScrollEvent(final boolean z, final Bundle bundle) {
Handler handler = this.mHandler;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
handler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$1$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onVerticalScrollEvent(z, bundle);
}
});
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onGreatestScrollPercentageIncreased(final int i, final Bundle bundle) {
Handler handler = this.mHandler;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
handler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$1$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onGreatestScrollPercentageIncreased(i, bundle);
}
});
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onSessionEnded(final boolean z, final Bundle bundle) {
Handler handler = this.mHandler;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
handler.post(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$1$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onSessionEnded(z, bundle);
}
});
}
}
private IEngagementSignalsCallback.Stub createEngagementSignalsCallbackWrapper(@NonNull EngagementSignalsCallback engagementSignalsCallback) {
return new AnonymousClass1(engagementSignalsCallback);
}
public boolean setEngagementSignalsCallback(@NonNull Executor executor, @NonNull EngagementSignalsCallback engagementSignalsCallback, @NonNull Bundle bundle) throws RemoteException {
try {
return this.mService.setEngagementSignalsCallback(this.mCallback, createEngagementSignalsCallbackWrapper(engagementSignalsCallback, executor).asBinder(), createBundleWithId(bundle));
} catch (SecurityException e) {
throw new UnsupportedOperationException("This method isn't supported by the Custom Tabs implementation.", e);
}
}
/* renamed from: androidx.browser.customtabs.CustomTabsSession$2, reason: invalid class name */
public class AnonymousClass2 extends IEngagementSignalsCallback.Stub {
private final Executor mExecutor;
final /* synthetic */ EngagementSignalsCallback val$callback;
final /* synthetic */ Executor val$executor;
public AnonymousClass2(Executor executor, EngagementSignalsCallback engagementSignalsCallback) {
this.val$executor = executor;
this.val$callback = engagementSignalsCallback;
this.mExecutor = executor;
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onVerticalScrollEvent(final boolean z, final Bundle bundle) {
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
Executor executor = this.mExecutor;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
executor.execute(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$2$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onVerticalScrollEvent(z, bundle);
}
});
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onGreatestScrollPercentageIncreased(final int i, final Bundle bundle) {
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
Executor executor = this.mExecutor;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
executor.execute(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$2$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onGreatestScrollPercentageIncreased(i, bundle);
}
});
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
@Override // android.support.customtabs.IEngagementSignalsCallback
public void onSessionEnded(final boolean z, final Bundle bundle) {
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
Executor executor = this.mExecutor;
final EngagementSignalsCallback engagementSignalsCallback = this.val$callback;
executor.execute(new Runnable() { // from class: androidx.browser.customtabs.CustomTabsSession$2$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
EngagementSignalsCallback.this.onSessionEnded(z, bundle);
}
});
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
}
private IEngagementSignalsCallback.Stub createEngagementSignalsCallbackWrapper(@NonNull EngagementSignalsCallback engagementSignalsCallback, @NonNull Executor executor) {
return new AnonymousClass2(executor, engagementSignalsCallback);
}
@Nullable
private Bundle createPostMessageExtraBundle(@Nullable Uri uri) {
Bundle bundle = new Bundle();
if (uri != null) {
bundle.putParcelable(TARGET_ORIGIN_KEY, uri);
}
if (this.mId != null) {
addIdToBundle(bundle);
}
if (bundle.isEmpty()) {
return null;
}
return bundle;
}
private Bundle createBundleWithId(@Nullable Bundle bundle) {
Bundle bundle2 = new Bundle();
if (bundle != null) {
bundle2.putAll(bundle);
}
addIdToBundle(bundle2);
return bundle2;
}
private void addIdToBundle(Bundle bundle) {
PendingIntent pendingIntent = this.mId;
if (pendingIntent != null) {
bundle.putParcelable(CustomTabsIntent.EXTRA_SESSION_ID, pendingIntent);
}
}
public IBinder getBinder() {
return this.mCallback.asBinder();
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static class PendingSession {
@Nullable
private final CustomTabsCallback mCallback;
@Nullable
private final PendingIntent mId;
@Nullable
public CustomTabsCallback getCallback() {
return this.mCallback;
}
@Nullable
public PendingIntent getId() {
return this.mId;
}
public PendingSession(@Nullable CustomTabsCallback customTabsCallback, @Nullable PendingIntent pendingIntent) {
this.mCallback = customTabsCallback;
this.mId = pendingIntent;
}
}
}

View File

@@ -0,0 +1,273 @@
package androidx.browser.customtabs;
import android.app.PendingIntent;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/* loaded from: classes.dex */
public class CustomTabsSessionToken {
private static final String TAG = "CustomTabsSessionToken";
@Nullable
private final CustomTabsCallback mCallback;
@Nullable
final ICustomTabsCallback mCallbackBinder;
@Nullable
private final PendingIntent mSessionId;
public static class MockCallback extends ICustomTabsCallback.Stub {
@Override // android.support.customtabs.ICustomTabsCallback.Stub, android.os.IInterface
public IBinder asBinder() {
return this;
}
@Override // android.support.customtabs.ICustomTabsCallback
public void extraCallback(String str, Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public Bundle extraCallbackWithResult(String str, Bundle bundle) {
return null;
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onActivityLayout(int i, int i2, int i3, int i4, int i5, @NonNull Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onActivityResized(int i, int i2, Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onMessageChannelReady(Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onMinimized(@NonNull Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onNavigationEvent(int i, Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onPostMessage(String str, Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onRelationshipValidationResult(int i, Uri uri, boolean z, Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onUnminimized(@NonNull Bundle bundle) {
}
@Override // android.support.customtabs.ICustomTabsCallback
public void onWarmupCompleted(Bundle bundle) {
}
}
@Nullable
public CustomTabsCallback getCallback() {
return this.mCallback;
}
@Nullable
public PendingIntent getId() {
return this.mSessionId;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public boolean hasCallback() {
return this.mCallbackBinder != null;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public boolean hasId() {
return this.mSessionId != null;
}
@Nullable
public static CustomTabsSessionToken getSessionTokenFromIntent(@NonNull Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null) {
return null;
}
IBinder binder = extras.getBinder(CustomTabsIntent.EXTRA_SESSION);
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(CustomTabsIntent.EXTRA_SESSION_ID);
if (binder == null && pendingIntent == null) {
return null;
}
return new CustomTabsSessionToken(binder != null ? ICustomTabsCallback.Stub.asInterface(binder) : null, pendingIntent);
}
@NonNull
public static CustomTabsSessionToken createMockSessionTokenForTesting() {
return new CustomTabsSessionToken(new MockCallback(), null);
}
public CustomTabsSessionToken(@Nullable ICustomTabsCallback iCustomTabsCallback, @Nullable PendingIntent pendingIntent) {
if (iCustomTabsCallback == null && pendingIntent == null) {
throw new IllegalStateException("CustomTabsSessionToken must have either a session id or a callback (or both).");
}
this.mCallbackBinder = iCustomTabsCallback;
this.mSessionId = pendingIntent;
this.mCallback = iCustomTabsCallback == null ? null : new CustomTabsCallback() { // from class: androidx.browser.customtabs.CustomTabsSessionToken.1
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onNavigationEvent(int i, @Nullable Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onNavigationEvent(i, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void extraCallback(@NonNull String str, @Nullable Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.extraCallback(str, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
@NonNull
public Bundle extraCallbackWithResult(@NonNull String str, @Nullable Bundle bundle) {
try {
return CustomTabsSessionToken.this.mCallbackBinder.extraCallbackWithResult(str, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
return null;
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onMessageChannelReady(@Nullable Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onMessageChannelReady(bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onPostMessage(@NonNull String str, @Nullable Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onPostMessage(str, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onRelationshipValidationResult(int i, @NonNull Uri uri, boolean z, @Nullable Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onRelationshipValidationResult(i, uri, z, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onActivityResized(int i, int i2, @NonNull Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onActivityResized(i, i2, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onWarmupCompleted(@NonNull Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onWarmupCompleted(bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onActivityLayout(int i, int i2, int i3, int i4, int i5, @NonNull Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onActivityLayout(i, i2, i3, i4, i5, bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onMinimized(@NonNull Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onMinimized(bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
@Override // androidx.browser.customtabs.CustomTabsCallback
public void onUnminimized(@NonNull Bundle bundle) {
try {
CustomTabsSessionToken.this.mCallbackBinder.onUnminimized(bundle);
} catch (RemoteException unused) {
Log.e(CustomTabsSessionToken.TAG, "RemoteException during ICustomTabsCallback transaction");
}
}
};
}
@Nullable
public IBinder getCallbackBinder() {
ICustomTabsCallback iCustomTabsCallback = this.mCallbackBinder;
if (iCustomTabsCallback == null) {
return null;
}
return iCustomTabsCallback.asBinder();
}
private IBinder getCallbackBinderAssertNotNull() {
ICustomTabsCallback iCustomTabsCallback = this.mCallbackBinder;
if (iCustomTabsCallback == null) {
throw new IllegalStateException("CustomTabSessionToken must have valid binder or pending session");
}
return iCustomTabsCallback.asBinder();
}
public int hashCode() {
PendingIntent pendingIntent = this.mSessionId;
if (pendingIntent != null) {
return pendingIntent.hashCode();
}
return getCallbackBinderAssertNotNull().hashCode();
}
public boolean equals(Object obj) {
if (!(obj instanceof CustomTabsSessionToken)) {
return false;
}
CustomTabsSessionToken customTabsSessionToken = (CustomTabsSessionToken) obj;
PendingIntent id = customTabsSessionToken.getId();
PendingIntent pendingIntent = this.mSessionId;
if ((pendingIntent == null) != (id == null)) {
return false;
}
if (pendingIntent != null) {
return pendingIntent.equals(id);
}
return getCallbackBinderAssertNotNull().equals(customTabsSessionToken.getCallbackBinderAssertNotNull());
}
public boolean isAssociatedWith(@NonNull CustomTabsSession customTabsSession) {
return customTabsSession.getBinder().equals(this.mCallbackBinder);
}
}

View File

@@ -0,0 +1,17 @@
package androidx.browser.customtabs;
import android.os.Bundle;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
public interface EngagementSignalsCallback {
default void onGreatestScrollPercentageIncreased(@IntRange(from = 1, to = 100) int i, @NonNull Bundle bundle) {
}
default void onSessionEnded(boolean z, @NonNull Bundle bundle) {
}
default void onVerticalScrollEvent(boolean z, @NonNull Bundle bundle) {
}
}

View File

@@ -0,0 +1,53 @@
package androidx.browser.customtabs;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.customtabs.IEngagementSignalsCallback;
import android.util.Log;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
final class EngagementSignalsCallbackRemote implements EngagementSignalsCallback {
private static final String TAG = "EngagementSigsCallbkRmt";
private final IEngagementSignalsCallback mCallbackBinder;
private EngagementSignalsCallbackRemote(@NonNull IEngagementSignalsCallback iEngagementSignalsCallback) {
this.mCallbackBinder = iEngagementSignalsCallback;
}
@NonNull
public static EngagementSignalsCallbackRemote fromBinder(@NonNull IBinder iBinder) {
return new EngagementSignalsCallbackRemote(IEngagementSignalsCallback.Stub.asInterface(iBinder));
}
@Override // androidx.browser.customtabs.EngagementSignalsCallback
public void onVerticalScrollEvent(boolean z, @NonNull Bundle bundle) {
try {
this.mCallbackBinder.onVerticalScrollEvent(z, bundle);
} catch (RemoteException unused) {
Log.e(TAG, "RemoteException during IEngagementSignalsCallback transaction");
}
}
@Override // androidx.browser.customtabs.EngagementSignalsCallback
public void onGreatestScrollPercentageIncreased(@IntRange(from = 1, to = 100) int i, @NonNull Bundle bundle) {
try {
this.mCallbackBinder.onGreatestScrollPercentageIncreased(i, bundle);
} catch (RemoteException unused) {
Log.e(TAG, "RemoteException during IEngagementSignalsCallback transaction");
}
}
@Override // androidx.browser.customtabs.EngagementSignalsCallback
public void onSessionEnded(boolean z, @NonNull Bundle bundle) {
try {
this.mCallbackBinder.onSessionEnded(z, bundle);
} catch (RemoteException unused) {
Log.e(TAG, "RemoteException during IEngagementSignalsCallback transaction");
}
}
}

View File

@@ -0,0 +1,8 @@
package androidx.browser.customtabs;
import androidx.annotation.RequiresOptIn;
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
/* loaded from: classes.dex */
public @interface ExperimentalMinimizationCallback {
}

View File

@@ -0,0 +1,17 @@
package androidx.browser.customtabs;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public interface PostMessageBackend {
void onDisconnectChannel(@NonNull Context context);
boolean onNotifyMessageChannelReady(@Nullable Bundle bundle);
boolean onPostMessage(@NonNull String str, @Nullable Bundle bundle);
}

View File

@@ -0,0 +1,32 @@
package androidx.browser.customtabs;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.support.customtabs.IPostMessageService;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/* loaded from: classes.dex */
public class PostMessageService extends Service {
private IPostMessageService.Stub mBinder = new IPostMessageService.Stub() { // from class: androidx.browser.customtabs.PostMessageService.1
@Override // android.support.customtabs.IPostMessageService
public void onMessageChannelReady(@NonNull ICustomTabsCallback iCustomTabsCallback, @Nullable Bundle bundle) throws RemoteException {
iCustomTabsCallback.onMessageChannelReady(bundle);
}
@Override // android.support.customtabs.IPostMessageService
public void onPostMessage(@NonNull ICustomTabsCallback iCustomTabsCallback, @NonNull String str, @Nullable Bundle bundle) throws RemoteException {
iCustomTabsCallback.onPostMessage(str, bundle);
}
};
@Override // android.app.Service
@NonNull
public IBinder onBind(@Nullable Intent intent) {
return this.mBinder;
}
}

View File

@@ -0,0 +1,159 @@
package androidx.browser.customtabs;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.customtabs.ICustomTabsCallback;
import android.support.customtabs.IPostMessageService;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/* loaded from: classes.dex */
public abstract class PostMessageServiceConnection implements PostMessageBackend, ServiceConnection {
private static final String TAG = "PostMessageServConn";
private final Object mLock = new Object();
private boolean mMessageChannelCreated;
@Nullable
private String mPackageName;
@Nullable
private IPostMessageService mService;
private final ICustomTabsCallback mSessionBinder;
private boolean isBoundToService() {
return this.mService != null;
}
public void onPostMessageServiceDisconnected() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void setPackageName(@NonNull String str) {
this.mPackageName = str;
}
public PostMessageServiceConnection(@NonNull CustomTabsSessionToken customTabsSessionToken) {
IBinder callbackBinder = customTabsSessionToken.getCallbackBinder();
if (callbackBinder == null) {
throw new IllegalArgumentException("Provided session must have binder.");
}
this.mSessionBinder = ICustomTabsCallback.Stub.asInterface(callbackBinder);
}
public boolean bindSessionToPostMessageService(@NonNull Context context, @NonNull String str) {
Intent intent = new Intent();
intent.setClassName(str, PostMessageService.class.getName());
boolean bindService = context.bindService(intent, this, 1);
if (!bindService) {
Log.w(TAG, "Could not bind to PostMessageService in client.");
}
return bindService;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public boolean bindSessionToPostMessageService(@NonNull Context context) {
String str = this.mPackageName;
if (str == null) {
throw new IllegalStateException("setPackageName must be called before bindSessionToPostMessageService.");
}
return bindSessionToPostMessageService(context, str);
}
public void unbindFromContext(@NonNull Context context) {
if (isBoundToService()) {
context.unbindService(this);
this.mService = null;
}
}
@Override // android.content.ServiceConnection
public final void onServiceConnected(@NonNull ComponentName componentName, @NonNull IBinder iBinder) {
this.mService = IPostMessageService.Stub.asInterface(iBinder);
onPostMessageServiceConnected();
}
@Override // android.content.ServiceConnection
public final void onServiceDisconnected(@NonNull ComponentName componentName) {
this.mService = null;
onPostMessageServiceDisconnected();
}
@Override // androidx.browser.customtabs.PostMessageBackend
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final boolean onNotifyMessageChannelReady(@Nullable Bundle bundle) {
return notifyMessageChannelReady(bundle);
}
public final boolean notifyMessageChannelReady(@Nullable Bundle bundle) {
this.mMessageChannelCreated = true;
return notifyMessageChannelReadyInternal(bundle);
}
private boolean notifyMessageChannelReadyInternal(@Nullable Bundle bundle) {
if (this.mService == null) {
return false;
}
synchronized (this.mLock) {
try {
try {
this.mService.onMessageChannelReady(this.mSessionBinder, bundle);
} catch (RemoteException unused) {
return false;
}
} catch (Throwable th) {
throw th;
}
}
return true;
}
@Override // androidx.browser.customtabs.PostMessageBackend
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final boolean onPostMessage(@NonNull String str, @Nullable Bundle bundle) {
return postMessage(str, bundle);
}
public final boolean postMessage(@NonNull String str, @Nullable Bundle bundle) {
if (this.mService == null) {
return false;
}
synchronized (this.mLock) {
try {
try {
this.mService.onPostMessage(this.mSessionBinder, str, bundle);
} catch (RemoteException unused) {
return false;
}
} catch (Throwable th) {
throw th;
}
}
return true;
}
@Override // androidx.browser.customtabs.PostMessageBackend
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void onDisconnectChannel(@NonNull Context context) {
unbindFromContext(context);
}
public void onPostMessageServiceConnected() {
if (this.mMessageChannelCreated) {
notifyMessageChannelReadyInternal(null);
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void cleanup(@NonNull Context context) {
if (isBoundToService()) {
unbindFromContext(context);
}
}
}

View File

@@ -0,0 +1,65 @@
package androidx.browser.customtabs;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.WorkerThread;
import androidx.core.content.FileProvider;
import java.io.File;
/* loaded from: classes.dex */
public class TrustedWebUtils {
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static final String ACTION_MANAGE_TRUSTED_WEB_ACTIVITY_DATA = "android.support.customtabs.action.ACTION_MANAGE_TRUSTED_WEB_ACTIVITY_DATA";
public static final String EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY = "android.support.customtabs.extra.LAUNCH_AS_TRUSTED_WEB_ACTIVITY";
private TrustedWebUtils() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static void launchBrowserSiteSettings(@NonNull Context context, @NonNull CustomTabsSession customTabsSession, @NonNull Uri uri) {
Intent intent = new Intent(ACTION_MANAGE_TRUSTED_WEB_ACTIVITY_DATA);
intent.setPackage(customTabsSession.getComponentName().getPackageName());
intent.setData(uri);
Bundle bundle = new Bundle();
bundle.putBinder(CustomTabsIntent.EXTRA_SESSION, customTabsSession.getBinder());
intent.putExtras(bundle);
PendingIntent id = customTabsSession.getId();
if (id != null) {
intent.putExtra(CustomTabsIntent.EXTRA_SESSION_ID, id);
}
context.startActivity(intent);
}
public static boolean areSplashScreensSupported(@NonNull Context context, @NonNull String str, @NonNull String str2) {
IntentFilter intentFilter;
ResolveInfo resolveService = context.getPackageManager().resolveService(new Intent().setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION).setPackage(str), 64);
if (resolveService == null || (intentFilter = resolveService.filter) == null) {
return false;
}
return intentFilter.hasCategory(str2);
}
@WorkerThread
public static boolean transferSplashImage(@NonNull Context context, @NonNull File file, @NonNull String str, @NonNull String str2, @NonNull CustomTabsSession customTabsSession) {
Uri uriForFile = FileProvider.getUriForFile(context, str, file);
context.grantUriPermission(str2, uriForFile, 1);
return customTabsSession.receiveFile(uriForFile, 1, null);
}
@Deprecated
public static void launchAsTrustedWebActivity(@NonNull Context context, @NonNull CustomTabsIntent customTabsIntent, @NonNull Uri uri) {
if (customTabsIntent.intent.getExtras().getBinder(CustomTabsIntent.EXTRA_SESSION) == null) {
throw new IllegalArgumentException("Given CustomTabsIntent should be associated with a valid CustomTabsSession");
}
customTabsIntent.intent.putExtra(EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY, true);
customTabsIntent.launchUrl(context, uri);
}
}