// Signature format: 2.0
package android {

  public static final class Manifest.permission {
    field public static final String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
    field public static final String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
    field public static final String APPROVE_INCIDENT_REPORTS = "android.permission.APPROVE_INCIDENT_REPORTS";
    field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
    field public static final String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
    field public static final String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA";
    field public static final String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
    field public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
    field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
    field public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
    field public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS";
    field public static final String WRITE_DEVICE_CONFIG = "android.permission.WRITE_DEVICE_CONFIG";
    field public static final String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE";
    field public static final String WRITE_OBB = "android.permission.WRITE_OBB";
  }

  public static final class R.bool {
    field public static final int config_perDisplayFocusEnabled = 17891332; // 0x1110004
  }

  public static final class R.string {
    field public static final int config_defaultAssistant = 17039393; // 0x1040021
    field public static final int config_defaultDialer = 17039395; // 0x1040023
  }

}

package android.animation {

  public class ValueAnimator extends android.animation.Animator {
    method public static float getDurationScale();
    method public static void setDurationScale(float);
  }

}

package android.app {

  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
    method public void onMovedToDisplay(int, android.content.res.Configuration);
  }

  public class ActivityManager {
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int);
    method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName);
    method @RequiresPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) public void forceStopPackage(String);
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getPackageImportance(String);
    method public long getTotalRam();
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidImportance(int);
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method public static void resumeAppSwitches() throws android.os.RemoteException;
    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
  }

  public static interface ActivityManager.OnUidImportanceListener {
    method public void onUidImportance(int, int);
  }

  public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
    field public static final int IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170; // 0xaa
  }

  public static class ActivityManager.TaskDescription implements android.os.Parcelable {
    method public String getIconFilename();
    method public int getIconResource();
  }

  public class ActivityOptions {
    method public void setLaunchActivityType(int);
    method public void setLaunchTaskId(int);
    method public void setLaunchWindowingMode(int);
    method public void setTaskOverlay(boolean, boolean);
  }

  public class ActivityTaskManager {
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void clearLaunchParamsForPackages(java.util.List<java.lang.String>);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public String listAllStacks();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void moveTaskToStack(int, int, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public boolean moveTopActivityToPinnedStack(int, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeStacksInWindowingModes(int[]) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void removeStacksWithActivityTypes(int[]) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeDockedStack(android.graphics.Rect, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeStack(int, android.graphics.Rect) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeStack(int, android.graphics.Rect, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void resizeTask(int, android.graphics.Rect);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setDisplayToSingleTaskInstance(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void startSystemLockTaskMode(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void stopSystemLockTaskMode();
    method public static boolean supportsMultiWindow(android.content.Context);
    method public static boolean supportsSplitScreenMultiWindow(android.content.Context);
    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
    field public static final int SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; // 0x1
    field public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; // 0x0
  }

  public class ActivityView extends android.view.ViewGroup {
    ctor public ActivityView(android.content.Context);
    ctor public ActivityView(android.content.Context, android.util.AttributeSet);
    ctor public ActivityView(android.content.Context, android.util.AttributeSet, int);
    ctor public ActivityView(android.content.Context, android.util.AttributeSet, int, boolean);
    method public int getVirtualDisplayId();
    method public void onLayout(boolean, int, int, int, int);
    method public void onLocationChanged();
    method public void performBackPress();
    method public void release();
    method public void setCallback(android.app.ActivityView.StateCallback);
    method public void setForwardedInsets(android.graphics.Insets);
    method public void startActivity(@NonNull android.content.Intent);
    method public void startActivity(@NonNull android.content.Intent, android.os.UserHandle);
    method public void startActivity(@NonNull android.app.PendingIntent);
    method public void startActivity(@NonNull android.app.PendingIntent, @NonNull android.app.ActivityOptions);
  }

  public abstract static class ActivityView.StateCallback {
    ctor public ActivityView.StateCallback();
    method public abstract void onActivityViewDestroyed(android.app.ActivityView);
    method public abstract void onActivityViewReady(android.app.ActivityView);
    method public void onTaskCreated(int, android.content.ComponentName);
    method public void onTaskMovedToFront(int);
    method public void onTaskRemovalStarted(int);
  }

  public class AppDetailsActivity extends android.app.Activity {
    ctor public AppDetailsActivity();
  }

  public class AppOpsManager {
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void addHistoricalOps(@NonNull android.app.AppOpsManager.HistoricalOps);
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void clearHistory();
    method @RequiresPermission("android.permission.GET_APP_OPS_STATS") public void getHistoricalOps(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void getHistoricalOpsFromDiskRaw(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
    method public static int getNumOps();
    method public static String[] getOpStrs();
    method public boolean isOperationActive(int, int, String);
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void offsetHistory(long);
    method public static int opToDefaultMode(@NonNull String);
    method public static String opToPermission(int);
    method public static int permissionToOpCode(String);
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void reloadNonHistoricalState();
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void resetHistoryParameters();
    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int);
    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(int, int, String, int);
    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(String, int, String, int);
    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(String, int, int);
    method public void startWatchingActive(@NonNull int[], @NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
    method public void stopWatchingActive(@NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
    method public static int strOpToOp(@NonNull String);
    field public static final int HISTORICAL_MODE_DISABLED = 0; // 0x0
    field public static final int HISTORICAL_MODE_ENABLED_ACTIVE = 1; // 0x1
    field public static final int HISTORICAL_MODE_ENABLED_PASSIVE = 2; // 0x2
    field public static final String OPSTR_ACCEPT_HANDOVER = "android:accept_handover";
    field public static final String OPSTR_ACCESS_NOTIFICATIONS = "android:access_notifications";
    field public static final String OPSTR_ACTIVATE_VPN = "android:activate_vpn";
    field public static final String OPSTR_ASSIST_SCREENSHOT = "android:assist_screenshot";
    field public static final String OPSTR_ASSIST_STRUCTURE = "android:assist_structure";
    field public static final String OPSTR_AUDIO_ACCESSIBILITY_VOLUME = "android:audio_accessibility_volume";
    field public static final String OPSTR_AUDIO_ALARM_VOLUME = "android:audio_alarm_volume";
    field public static final String OPSTR_AUDIO_BLUETOOTH_VOLUME = "android:audio_bluetooth_volume";
    field public static final String OPSTR_AUDIO_MASTER_VOLUME = "android:audio_master_volume";
    field public static final String OPSTR_AUDIO_MEDIA_VOLUME = "android:audio_media_volume";
    field public static final String OPSTR_AUDIO_NOTIFICATION_VOLUME = "android:audio_notification_volume";
    field public static final String OPSTR_AUDIO_RING_VOLUME = "android:audio_ring_volume";
    field public static final String OPSTR_AUDIO_VOICE_VOLUME = "android:audio_voice_volume";
    field public static final String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service";
    field public static final String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state";
    field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts";
    field public static final String OPSTR_GPS = "android:gps";
    field public static final String OPSTR_INSTANT_APP_START_FOREGROUND = "android:instant_app_start_foreground";
    field public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
    field public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
    field public static final String OPSTR_MUTE_MICROPHONE = "android:mute_microphone";
    field public static final String OPSTR_NEIGHBORING_CELLS = "android:neighboring_cells";
    field public static final String OPSTR_PLAY_AUDIO = "android:play_audio";
    field public static final String OPSTR_POST_NOTIFICATION = "android:post_notification";
    field public static final String OPSTR_PROJECT_MEDIA = "android:project_media";
    field public static final String OPSTR_READ_CLIPBOARD = "android:read_clipboard";
    field public static final String OPSTR_READ_ICC_SMS = "android:read_icc_sms";
    field public static final String OPSTR_RECEIVE_EMERGENCY_BROADCAST = "android:receive_emergency_broadcast";
    field public static final String OPSTR_REQUEST_DELETE_PACKAGES = "android:request_delete_packages";
    field public static final String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages";
    field public static final String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background";
    field public static final String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background";
    field public static final String OPSTR_START_FOREGROUND = "android:start_foreground";
    field public static final String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus";
    field public static final String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons";
    field public static final String OPSTR_TOAST_WINDOW = "android:toast_window";
    field public static final String OPSTR_TURN_SCREEN_ON = "android:turn_screen_on";
    field public static final String OPSTR_VIBRATE = "android:vibrate";
    field public static final String OPSTR_WAKE_LOCK = "android:wake_lock";
    field public static final String OPSTR_WIFI_SCAN = "android:wifi_scan";
    field public static final String OPSTR_WRITE_CLIPBOARD = "android:write_clipboard";
    field public static final String OPSTR_WRITE_ICC_SMS = "android:write_icc_sms";
    field public static final String OPSTR_WRITE_SMS = "android:write_sms";
    field public static final String OPSTR_WRITE_WALLPAPER = "android:write_wallpaper";
    field public static final int OP_COARSE_LOCATION = 0; // 0x0
    field public static final int OP_FLAGS_ALL = 31; // 0x1f
    field public static final int OP_FLAG_SELF = 1; // 0x1
    field public static final int OP_FLAG_TRUSTED_PROXIED = 8; // 0x8
    field public static final int OP_FLAG_TRUSTED_PROXY = 2; // 0x2
    field public static final int OP_FLAG_UNTRUSTED_PROXIED = 16; // 0x10
    field public static final int OP_FLAG_UNTRUSTED_PROXY = 4; // 0x4
    field public static final int OP_RECORD_AUDIO = 27; // 0x1b
    field public static final int OP_START_FOREGROUND = 76; // 0x4c
    field public static final int OP_SYSTEM_ALERT_WINDOW = 24; // 0x18
    field public static final int UID_STATE_BACKGROUND = 600; // 0x258
    field public static final int UID_STATE_CACHED = 700; // 0x2bc
    field public static final int UID_STATE_FOREGROUND = 500; // 0x1f4
    field public static final int UID_STATE_FOREGROUND_SERVICE = 400; // 0x190
    field public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300; // 0x12c
    field public static final int UID_STATE_PERSISTENT = 100; // 0x64
    field public static final int UID_STATE_TOP = 200; // 0xc8
  }

  public static final class AppOpsManager.HistoricalOp implements android.os.Parcelable {
    method public int describeContents();
    method public long getAccessCount(int, int, int);
    method public long getAccessDuration(int, int, int);
    method public long getBackgroundAccessCount(int);
    method public long getBackgroundAccessDuration(int);
    method public long getBackgroundRejectCount(int);
    method public long getForegroundAccessCount(int);
    method public long getForegroundAccessDuration(int);
    method public long getForegroundRejectCount(int);
    method @NonNull public String getOpName();
    method public long getRejectCount(int, int, int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOp> CREATOR;
  }

  public static final class AppOpsManager.HistoricalOps implements android.os.Parcelable {
    ctor public AppOpsManager.HistoricalOps(long, long);
    method public int describeContents();
    method public long getBeginTimeMillis();
    method public long getEndTimeMillis();
    method @IntRange(from=0) public int getUidCount();
    method @Nullable public android.app.AppOpsManager.HistoricalUidOps getUidOps(int);
    method @NonNull public android.app.AppOpsManager.HistoricalUidOps getUidOpsAt(@IntRange(from=0) int);
    method public void increaseAccessCount(int, int, @NonNull String, int, int, long);
    method public void increaseAccessDuration(int, int, @NonNull String, int, int, long);
    method public void increaseRejectCount(int, int, @NonNull String, int, int, long);
    method public void offsetBeginAndEndTime(long);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOps> CREATOR;
  }

  public static final class AppOpsManager.HistoricalOpsRequest {
  }

  public static final class AppOpsManager.HistoricalOpsRequest.Builder {
    ctor public AppOpsManager.HistoricalOpsRequest.Builder(long, long);
    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest build();
    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setFlags(int);
    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setOpNames(@Nullable java.util.List<java.lang.String>);
    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setPackageName(@Nullable String);
    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setUid(int);
  }

  public static final class AppOpsManager.HistoricalPackageOps implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.app.AppOpsManager.HistoricalOp getOp(@NonNull String);
    method @NonNull public android.app.AppOpsManager.HistoricalOp getOpAt(@IntRange(from=0) int);
    method @IntRange(from=0) public int getOpCount();
    method @NonNull public String getPackageName();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalPackageOps> CREATOR;
  }

  public static final class AppOpsManager.HistoricalUidOps implements android.os.Parcelable {
    method public int describeContents();
    method @IntRange(from=0) public int getPackageCount();
    method @Nullable public android.app.AppOpsManager.HistoricalPackageOps getPackageOps(@NonNull String);
    method @NonNull public android.app.AppOpsManager.HistoricalPackageOps getPackageOpsAt(@IntRange(from=0) int);
    method public int getUid();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalUidOps> CREATOR;
  }

  public static interface AppOpsManager.OnOpActiveChangedListener {
    method public void onOpActiveChanged(int, int, String, boolean);
  }

  public static final class AppOpsManager.OpEntry implements android.os.Parcelable {
    method public int describeContents();
    method public long getDuration();
    method public long getLastAccessBackgroundTime(int);
    method public long getLastAccessForegroundTime(int);
    method public long getLastAccessTime(int);
    method public long getLastAccessTime(int, int, int);
    method public long getLastBackgroundDuration(int);
    method public long getLastDuration(int, int, int);
    method public long getLastForegroundDuration(int);
    method public long getLastRejectBackgroundTime(int);
    method public long getLastRejectForegroundTime(int);
    method public long getLastRejectTime(int);
    method public long getLastRejectTime(int, int, int);
    method public int getMode();
    method @NonNull public String getOpStr();
    method @Nullable public String getProxyPackageName();
    method @Nullable public String getProxyPackageName(int, int);
    method public int getProxyUid();
    method public int getProxyUid(int, int);
    method public boolean isRunning();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpEntry> CREATOR;
  }

  public class DownloadManager {
    field public static final String COLUMN_MEDIASTORE_URI = "mediastore_uri";
  }

  public final class NotificationChannel implements android.os.Parcelable {
    method public boolean isImportanceLockedByCriticalDeviceFunction();
    method public boolean isImportanceLockedByOEM();
    method public void setImportanceLockedByCriticalDeviceFunction(boolean);
    method public void setImportanceLockedByOEM(boolean);
  }

  public final class NotificationChannelGroup implements android.os.Parcelable {
    method public int getUserLockedFields();
    method public void lockFields(int);
    method public void setBlocked(boolean);
  }

  public class NotificationManager {
    method public void allowAssistantAdjustment(String);
    method public void disallowAssistantAdjustment(String);
    method @NonNull public java.util.List<java.lang.String> getAllowedAssistantAdjustments();
    method @Nullable public android.content.ComponentName getAllowedNotificationAssistant();
    method public android.content.ComponentName getEffectsSuppressor();
    method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName);
    method public boolean matchesCallFilter(android.os.Bundle);
    method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean);
  }

  public final class PictureInPictureParams implements android.os.Parcelable {
    method public java.util.List<android.app.RemoteAction> getActions();
    method public float getAspectRatio();
    method public android.graphics.Rect getSourceRectHint();
  }

  public class StatusBarManager {
    method @NonNull @RequiresPermission(android.Manifest.permission.STATUS_BAR) public android.app.StatusBarManager.DisableInfo getDisableInfo();
    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setDisabledForSetup(boolean);
  }

  public static final class StatusBarManager.DisableInfo {
    method public boolean areAllComponentsEnabled();
    method public boolean isNavigateToHomeDisabled();
    method public boolean isNotificationPeekingDisabled();
    method public boolean isRecentsDisabled();
    method public boolean isSearchDisabled();
    method public boolean isStatusBarExpansionDisabled();
  }

  public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener {
    method public android.widget.TimePicker getTimePicker();
  }

  public final class UiAutomation {
    method public void destroy();
    method public android.os.ParcelFileDescriptor[] executeShellCommandRw(String);
    method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle);
    method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
    method public void syncInputTransactions();
  }

  public class UiModeManager {
    method public boolean isNightModeLocked();
    method public boolean isUiModeLocked();
  }

  public class WallpaperManager {
    method @RequiresPermission("android.permission.SET_WALLPAPER_COMPONENT") public boolean setWallpaperComponent(android.content.ComponentName);
  }

  public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable {
    ctor public WindowConfiguration();
    method public int compareTo(android.app.WindowConfiguration);
    method public int describeContents();
    method public int getActivityType();
    method public android.graphics.Rect getAppBounds();
    method public android.graphics.Rect getBounds();
    method public int getRotation();
    method public int getWindowingMode();
    method public void setActivityType(int);
    method public void setAppBounds(android.graphics.Rect);
    method public void setBounds(android.graphics.Rect);
    method public void setRotation(int);
    method public void setTo(android.app.WindowConfiguration);
    method public void setWindowingMode(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACTIVITY_TYPE_ASSISTANT = 4; // 0x4
    field public static final int ACTIVITY_TYPE_HOME = 2; // 0x2
    field public static final int ACTIVITY_TYPE_RECENTS = 3; // 0x3
    field public static final int ACTIVITY_TYPE_STANDARD = 1; // 0x1
    field public static final int ACTIVITY_TYPE_UNDEFINED = 0; // 0x0
    field public static final int ROTATION_UNDEFINED = -1; // 0xffffffff
    field public static final int WINDOWING_MODE_FREEFORM = 5; // 0x5
    field public static final int WINDOWING_MODE_FULLSCREEN = 1; // 0x1
    field public static final int WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY = 4; // 0x4
    field public static final int WINDOWING_MODE_PINNED = 2; // 0x2
    field public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY = 3; // 0x3
    field public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY = 4; // 0x4
    field public static final int WINDOWING_MODE_UNDEFINED = 0; // 0x0
  }

}

package android.app.admin {

  public class DevicePolicyManager {
    method @Nullable public CharSequence getDeviceOwnerOrganizationName();
    method public long getLastBugReportRequestTime();
    method public long getLastNetworkLogRetrievalTime();
    method public long getLastSecurityLogRetrievalTime();
    method public java.util.List<java.lang.String> getOwnerInstalledCaCerts(@NonNull android.os.UserHandle);
    method public boolean isCurrentInputMethodSetByOwner();
    method public boolean isDeviceManaged();
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED";
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_DISALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_DISALLOWED";
    field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
    field public static final String EXTRA_RESTRICTION = "android.app.extra.RESTRICTION";
  }

  public static final class SecurityLog.SecurityEvent implements android.os.Parcelable {
    ctor public SecurityLog.SecurityEvent(long, byte[]);
  }

}

package android.app.assist {

  public static class AssistStructure.ViewNode {
    ctor public AssistStructure.ViewNode();
  }

}

package android.app.backup {

  public class BackupManager {
    method @RequiresPermission("android.permission.BACKUP") public android.content.Intent getConfigurationIntent(String);
    method @RequiresPermission("android.permission.BACKUP") public android.content.Intent getDataManagementIntent(String);
    method @Nullable @RequiresPermission("android.permission.BACKUP") public CharSequence getDataManagementIntentLabel(@NonNull String);
    method @Deprecated @Nullable @RequiresPermission("android.permission.BACKUP") public String getDataManagementLabel(@NonNull String);
    method @RequiresPermission("android.permission.BACKUP") public String getDestinationString(String);
  }

}

package android.app.prediction {

  public final class AppPredictionContext implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.os.Bundle getExtras();
    method @NonNull public String getPackageName();
    method @IntRange(from=0) public int getPredictedTargetCount();
    method @NonNull public String getUiSurface();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionContext> CREATOR;
  }

  public static final class AppPredictionContext.Builder {
    ctor public AppPredictionContext.Builder(@NonNull android.content.Context);
    method @NonNull public android.app.prediction.AppPredictionContext build();
    method @NonNull public android.app.prediction.AppPredictionContext.Builder setExtras(@Nullable android.os.Bundle);
    method @NonNull public android.app.prediction.AppPredictionContext.Builder setPredictedTargetCount(@IntRange(from=0) int);
    method @NonNull public android.app.prediction.AppPredictionContext.Builder setUiSurface(@NonNull String);
  }

  public final class AppPredictionManager {
    method @NonNull public android.app.prediction.AppPredictor createAppPredictionSession(@NonNull android.app.prediction.AppPredictionContext);
  }

  public final class AppPredictionSessionId implements android.os.Parcelable {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionSessionId> CREATOR;
  }

  public final class AppPredictor {
    method public void destroy();
    method public android.app.prediction.AppPredictionSessionId getSessionId();
    method public void notifyAppTargetEvent(@NonNull android.app.prediction.AppTargetEvent);
    method public void notifyLaunchLocationShown(@NonNull String, @NonNull java.util.List<android.app.prediction.AppTargetId>);
    method public void registerPredictionUpdates(@NonNull java.util.concurrent.Executor, @NonNull android.app.prediction.AppPredictor.Callback);
    method public void requestPredictionUpdate();
    method @Nullable public void sortTargets(@NonNull java.util.List<android.app.prediction.AppTarget>, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<android.app.prediction.AppTarget>>);
    method public void unregisterPredictionUpdates(@NonNull android.app.prediction.AppPredictor.Callback);
  }

  public static interface AppPredictor.Callback {
    method public void onTargetsAvailable(@NonNull java.util.List<android.app.prediction.AppTarget>);
  }

  public final class AppTarget implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getClassName();
    method @NonNull public android.app.prediction.AppTargetId getId();
    method @NonNull public String getPackageName();
    method @IntRange(from=0) public int getRank();
    method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
    method @NonNull public android.os.UserHandle getUser();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTarget> CREATOR;
  }

  public static final class AppTarget.Builder {
    ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull String, @NonNull android.os.UserHandle);
    ctor public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId, @NonNull android.content.pm.ShortcutInfo);
    method @NonNull public android.app.prediction.AppTarget build();
    method @NonNull public android.app.prediction.AppTarget.Builder setClassName(@NonNull String);
    method @NonNull public android.app.prediction.AppTarget.Builder setRank(@IntRange(from=0) int);
  }

  public final class AppTargetEvent implements android.os.Parcelable {
    method public int describeContents();
    method public int getAction();
    method @Nullable public String getLaunchLocation();
    method @Nullable public android.app.prediction.AppTarget getTarget();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACTION_DISMISS = 2; // 0x2
    field public static final int ACTION_LAUNCH = 1; // 0x1
    field public static final int ACTION_PIN = 3; // 0x3
    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetEvent> CREATOR;
  }

  public static final class AppTargetEvent.Builder {
    ctor public AppTargetEvent.Builder(@Nullable android.app.prediction.AppTarget, int);
    method @NonNull public android.app.prediction.AppTargetEvent build();
    method @NonNull public android.app.prediction.AppTargetEvent.Builder setLaunchLocation(@Nullable String);
  }

  public final class AppTargetId implements android.os.Parcelable {
    ctor public AppTargetId(@NonNull String);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetId> CREATOR;
  }

}

package android.app.role {

  public interface OnRoleHoldersChangedListener {
    method public void onRoleHoldersChanged(@NonNull String, @NonNull android.os.UserHandle);
  }

  public final class RoleManager {
    method @RequiresPermission("android.permission.OBSERVE_ROLE_HOLDERS") public void addOnRoleHoldersChangedListenerAsUser(@NonNull java.util.concurrent.Executor, @NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void addRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean addRoleHolderFromController(@NonNull String, @NonNull String);
    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void clearRoleHoldersAsUser(@NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @NonNull @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public java.util.List<java.lang.String> getHeldRolesFromController(@NonNull String);
    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHolders(@NonNull String);
    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHoldersAsUser(@NonNull String, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.OBSERVE_ROLE_HOLDERS") public void removeOnRoleHoldersChangedListenerAsUser(@NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean removeRoleHolderFromController(@NonNull String, @NonNull String);
    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public void setRoleNamesFromController(@NonNull java.util.List<java.lang.String>);
    field public static final int MANAGE_HOLDERS_FLAG_DONT_KILL_APP = 1; // 0x1
  }

}

package android.app.usage {

  public class NetworkStatsManager {
    method public void setPollForce(boolean);
  }

  public class StorageStatsManager {
    method public boolean isQuotaSupported(@NonNull java.util.UUID);
    method public boolean isReservedSupported(@NonNull java.util.UUID);
  }

  public final class UsageStatsManager {
    method public void forceUsageSourceSettingRead();
  }

}

package android.bluetooth {

  public final class BluetoothClass implements android.os.Parcelable {
    method public int getClassOfDevice();
  }

}

package android.content {

  public final class AutofillOptions implements android.os.Parcelable {
    ctor public AutofillOptions(int, boolean);
    method public int describeContents();
    method public static android.content.AutofillOptions forWhitelistingItself();
    method public boolean isAugmentedAutofillEnabled(@NonNull android.content.Context);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.AutofillOptions> CREATOR;
    field public boolean augmentedAutofillEnabled;
    field public final boolean compatModeEnabled;
    field public final int loggingLevel;
    field @Nullable public android.util.ArraySet<android.content.ComponentName> whitelistedActivitiesForAugmentedAutofill;
  }

  public final class ContentCaptureOptions implements android.os.Parcelable {
    ctor public ContentCaptureOptions(int);
    ctor public ContentCaptureOptions(int, int, int, int, int, @Nullable android.util.ArraySet<android.content.ComponentName>);
    method public int describeContents();
    method public static android.content.ContentCaptureOptions forWhitelistingItself();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentCaptureOptions> CREATOR;
    field public final int idleFlushingFrequencyMs;
    field public final boolean lite;
    field public final int logHistorySize;
    field public final int loggingLevel;
    field public final int maxBufferSize;
    field public final int textChangeFlushingFrequencyMs;
    field @Nullable public final android.util.ArraySet<android.content.ComponentName> whitelistedComponents;
  }

  public class ContentProviderClient implements java.lang.AutoCloseable {
    method @RequiresPermission(android.Manifest.permission.REMOVE_TASKS) public void setDetectNotResponding(long);
  }

  public abstract class ContentResolver {
    method public static String[] getSyncAdapterPackagesForAuthorityAsUser(String, int);
  }

  public abstract class Context {
    method public android.content.Context createPackageContextAsUser(String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract android.view.Display getDisplay();
    method public abstract int getDisplayId();
    method public android.os.UserHandle getUser();
    method public int getUserId();
    method public void setAutofillOptions(@Nullable android.content.AutofillOptions);
    method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
    field public static final String BUGREPORT_SERVICE = "bugreport";
    field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
    field public static final String ROLLBACK_SERVICE = "rollback";
    field public static final String STATUS_BAR_SERVICE = "statusbar";
    field public static final String TEST_NETWORK_SERVICE = "test_network";
  }

  public class ContextWrapper extends android.content.Context {
    method public android.view.Display getDisplay();
    method public int getDisplayId();
  }

  public class Intent implements java.lang.Cloneable android.os.Parcelable {
    field public static final String ACTION_ROLLBACK_COMMITTED = "android.intent.action.ROLLBACK_COMMITTED";
    field public static final String EXTRA_ROLE_NAME = "android.intent.extra.ROLE_NAME";
  }

}

package android.content.pm {

  public class ActivityInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
    method public static boolean isTranslucentOrFloating(android.content.res.TypedArray);
    field public static final int RESIZE_MODE_RESIZEABLE = 2; // 0x2
  }

  public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    method public boolean isPrivilegedApp();
    method public boolean isSystemApp();
    field public static final int PRIVATE_FLAG_PRIVILEGED = 8; // 0x8
    field public int privateFlags;
  }

  public class LauncherApps {
    ctor public LauncherApps(android.content.Context);
  }

  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
    method @NonNull public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions();
  }

  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
    method public void setEnableRollback(boolean);
    method @RequiresPermission("android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS") public void setGrantedRuntimePermissions(String[]);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setInstallAsApex();
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setStaged();
  }

  public abstract class PackageManager {
    method public abstract boolean arePermissionsIndividuallyControlled();
    method @Nullable @RequiresPermission("android.permission.INTERACT_ACROSS_USERS_FULL") public abstract String getDefaultBrowserPackageNameAsUser(int);
    method @Nullable public String getIncidentReportApproverPackageName();
    method public abstract int getInstallReason(@NonNull String, @NonNull android.os.UserHandle);
    method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
    method @NonNull @RequiresPermission("android.permission.INTERACT_ACROSS_USERS_FULL") public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
    method @Nullable public abstract String[] getNamesForUids(int[]);
    method @NonNull public abstract String getPermissionControllerPackageName();
    method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.REVOKE_RUNTIME_PERMISSIONS", "android.permission.GET_RUNTIME_PERMISSIONS"}) public abstract int getPermissionFlags(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
    method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
    method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
    method @Nullable public String getWellbeingPackageName();
    method @RequiresPermission("android.permission.GRANT_RUNTIME_PERMISSIONS") public abstract void grantRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.REVOKE_RUNTIME_PERMISSIONS") public abstract void revokeRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
    method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.REVOKE_RUNTIME_PERMISSIONS"}) public abstract void updatePermissionFlags(@NonNull String, @NonNull String, int, int, @NonNull android.os.UserHandle);
    field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
    field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
    field public static final int FLAG_PERMISSION_APPLY_RESTRICTION = 16384; // 0x4000
    field public static final int FLAG_PERMISSION_GRANTED_BY_ROLE = 32768; // 0x8000
    field public static final int FLAG_PERMISSION_POLICY_FIXED = 4; // 0x4
    field public static final int FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT = 2048; // 0x800
    field public static final int FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT = 4096; // 0x1000
    field public static final int FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT = 8192; // 0x2000
    field public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 64; // 0x40
    field public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 8; // 0x8
    field public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 128; // 0x80
    field public static final int FLAG_PERMISSION_SYSTEM_FIXED = 16; // 0x10
    field public static final int FLAG_PERMISSION_USER_FIXED = 2; // 0x2
    field public static final int FLAG_PERMISSION_USER_SET = 1; // 0x1
    field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000
    field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000
    field public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
    field public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
  }

  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    field public static final int FLAG_REMOVED = 2; // 0x2
    field public static final int PROTECTION_FLAG_APP_PREDICTOR = 2097152; // 0x200000
    field public static final int PROTECTION_FLAG_CONFIGURATOR = 524288; // 0x80000
    field public static final int PROTECTION_FLAG_DOCUMENTER = 262144; // 0x40000
    field public static final int PROTECTION_FLAG_INCIDENT_REPORT_APPROVER = 1048576; // 0x100000
    field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
    field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
    field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
    field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
    field @Nullable public final String backgroundPermission;
  }

  public final class ShortcutInfo implements android.os.Parcelable {
    method public boolean isVisibleToPublisher();
  }

  public class ShortcutManager {
    ctor public ShortcutManager(android.content.Context);
  }

}

package android.content.res {

  public final class AssetManager implements java.lang.AutoCloseable {
    method @NonNull public String[] getApkPaths();
    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getOverlayableMap(String);
  }

  public final class Configuration implements java.lang.Comparable<android.content.res.Configuration> android.os.Parcelable {
    field public int assetsSeq;
    field public final android.app.WindowConfiguration windowConfiguration;
  }

}

package android.content.rollback {

  public final class PackageRollbackInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public String getPackageName();
    method @NonNull public android.content.pm.VersionedPackage getVersionRolledBackFrom();
    method @NonNull public android.content.pm.VersionedPackage getVersionRolledBackTo();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.rollback.PackageRollbackInfo> CREATOR;
  }

  public final class RollbackInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<android.content.pm.VersionedPackage> getCausePackages();
    method public int getCommittedSessionId();
    method @NonNull public java.util.List<android.content.rollback.PackageRollbackInfo> getPackages();
    method public int getRollbackId();
    method public boolean isStaged();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.rollback.RollbackInfo> CREATOR;
  }

  public final class RollbackManager {
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) public void commitRollback(int, @NonNull java.util.List<android.content.pm.VersionedPackage>, @NonNull android.content.IntentSender);
    method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void expireRollbackForPackage(@NonNull String);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
    method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void reloadPersistedData();
    field public static final String EXTRA_STATUS = "android.content.rollback.extra.STATUS";
    field public static final String EXTRA_STATUS_MESSAGE = "android.content.rollback.extra.STATUS_MESSAGE";
    field public static final String PROPERTY_ROLLBACK_LIFETIME_MILLIS = "rollback_lifetime_in_millis";
    field public static final int STATUS_FAILURE = 1; // 0x1
    field public static final int STATUS_FAILURE_INSTALL = 3; // 0x3
    field public static final int STATUS_FAILURE_ROLLBACK_UNAVAILABLE = 2; // 0x2
    field public static final int STATUS_SUCCESS = 0; // 0x0
  }

}

package android.database.sqlite {

  public class SQLiteCompatibilityWalFlags {
    method public static void reset();
  }

  public final class SQLiteDebug {
    method public static void dump(android.util.Printer, String[]);
    method public static android.database.sqlite.SQLiteDebug.PagerStats getDatabaseInfo();
  }

  public static class SQLiteDebug.DbStats {
    ctor public SQLiteDebug.DbStats(String, long, long, int, int, int, int);
    field public String cache;
    field public String dbName;
    field public long dbSize;
    field public int lookaside;
    field public long pageSize;
  }

  public static class SQLiteDebug.PagerStats {
    ctor public SQLiteDebug.PagerStats();
    field public java.util.ArrayList<android.database.sqlite.SQLiteDebug.DbStats> dbStats;
    field public int largestMemAlloc;
    field public int memoryUsed;
    field public int pageCacheOverflow;
  }

  public final class SQLiteDirectCursorDriver implements android.database.sqlite.SQLiteCursorDriver {
    ctor public SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal);
    method public void cursorClosed();
    method public void cursorDeactivated();
    method public void cursorRequeried(android.database.Cursor);
    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]);
    method public void setBindArguments(String[]);
  }

  public final class SQLiteGlobal {
    method public static String getDefaultJournalMode();
    method public static int getDefaultPageSize();
    method public static String getDefaultSyncMode();
    method public static int getIdleConnectionTimeout();
    method public static int getJournalSizeLimit();
    method public static int getWALAutoCheckpoint();
    method public static int getWALConnectionPoolSize();
    method public static String getWALSyncMode();
    method public static int releaseMemory();
  }

}

package android.graphics {

  public final class ImageDecoder implements java.lang.AutoCloseable {
    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(android.content.res.Resources, java.io.InputStream, int);
  }

}

package android.graphics.drawable {

  public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
    method public android.graphics.Region getSafeZone();
    field public static final float MASK_SIZE = 100.0f;
  }

  public class ColorDrawable extends android.graphics.drawable.Drawable {
    method public android.graphics.Xfermode getXfermode();
  }

  public abstract class Drawable {
    method public boolean hasFocusStateSpecified();
  }

  public class ShapeDrawable extends android.graphics.drawable.Drawable {
    method public void setXfermode(@Nullable android.graphics.Xfermode);
  }

}

package android.hardware.camera2 {

  public abstract class CameraDevice implements java.lang.AutoCloseable {
    method public abstract void createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    field public static final int SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED = 1; // 0x1
    field public static final int SESSION_OPERATION_MODE_NORMAL = 0; // 0x0
    field public static final int SESSION_OPERATION_MODE_VENDOR_START = 32768; // 0x8000
  }

}

package android.hardware.display {

  public final class AmbientBrightnessDayStats implements android.os.Parcelable {
    method public int describeContents();
    method public float[] getBucketBoundaries();
    method public java.time.LocalDate getLocalDate();
    method public float[] getStats();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.AmbientBrightnessDayStats> CREATOR;
  }

  public class AmbientDisplayConfiguration {
    ctor public AmbientDisplayConfiguration(android.content.Context);
    method public boolean alwaysOnAvailable();
    method public boolean alwaysOnAvailableForUser(int);
    method public boolean alwaysOnEnabled(int);
  }

  public final class BrightnessChangeEvent implements android.os.Parcelable {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessChangeEvent> CREATOR;
    field public final float batteryLevel;
    field public final float brightness;
    field public final long colorSampleDuration;
    field public final int colorTemperature;
    field @Nullable public final long[] colorValueBuckets;
    field public final boolean isDefaultBrightnessConfig;
    field public final boolean isUserSetBrightness;
    field public final float lastBrightness;
    field public final long[] luxTimestamps;
    field public final float[] luxValues;
    field public final boolean nightMode;
    field public final String packageName;
    field public final float powerBrightnessFactor;
    field public final long timeStamp;
  }

  public final class BrightnessConfiguration implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.hardware.display.BrightnessCorrection getCorrectionByCategory(int);
    method @Nullable public android.hardware.display.BrightnessCorrection getCorrectionByPackageName(@NonNull String);
    method public android.util.Pair<float[],float[]> getCurve();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
  }

  public static class BrightnessConfiguration.Builder {
    ctor public BrightnessConfiguration.Builder(float[], float[]);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, @NonNull android.hardware.display.BrightnessCorrection);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(@NonNull String, @NonNull android.hardware.display.BrightnessCorrection);
    method @NonNull public android.hardware.display.BrightnessConfiguration build();
    method public int getMaxCorrectionsByCategory();
    method public int getMaxCorrectionsByPackageName();
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setDescription(@Nullable String);
  }

  public final class BrightnessCorrection implements android.os.Parcelable {
    method @FloatRange(from=0.0) public float apply(@FloatRange(from=0.0) float);
    method @NonNull public static android.hardware.display.BrightnessCorrection createScaleAndTranslateLog(float, float);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
  }

  public final class DisplayManager {
    method @RequiresPermission("android.permission.ACCESS_AMBIENT_LIGHT_STATS") public java.util.List<android.hardware.display.AmbientBrightnessDayStats> getAmbientBrightnessStats();
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public android.hardware.display.BrightnessConfiguration getBrightnessConfiguration();
    method @RequiresPermission(android.Manifest.permission.BRIGHTNESS_SLIDER_USAGE) public java.util.List<android.hardware.display.BrightnessChangeEvent> getBrightnessEvents();
    method @Nullable @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public android.hardware.display.BrightnessConfiguration getDefaultBrightnessConfiguration();
    method public android.graphics.Point getStableDisplaySize();
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
  }

}

package android.location {

  public final class GnssClock implements android.os.Parcelable {
    ctor public GnssClock();
    method public void reset();
    method public void resetBiasNanos();
    method public void resetBiasUncertaintyNanos();
    method public void resetDriftNanosPerSecond();
    method public void resetDriftUncertaintyNanosPerSecond();
    method public void resetElapsedRealtimeNanos();
    method public void resetElapsedRealtimeUncertaintyNanos();
    method public void resetFullBiasNanos();
    method public void resetLeapSecond();
    method public void resetTimeUncertaintyNanos();
    method public void set(android.location.GnssClock);
    method public void setBiasNanos(double);
    method public void setBiasUncertaintyNanos(@FloatRange(from=0.0f) double);
    method public void setDriftNanosPerSecond(double);
    method public void setDriftUncertaintyNanosPerSecond(@FloatRange(from=0.0f) double);
    method public void setElapsedRealtimeNanos(long);
    method public void setElapsedRealtimeUncertaintyNanos(@FloatRange(from=0.0f) double);
    method public void setFullBiasNanos(long);
    method public void setHardwareClockDiscontinuityCount(int);
    method public void setLeapSecond(int);
    method public void setTimeNanos(long);
    method public void setTimeUncertaintyNanos(@FloatRange(from=0.0f) double);
  }

  public final class GnssMeasurement implements android.os.Parcelable {
    ctor public GnssMeasurement();
    method public void reset();
    method public void resetAutomaticGainControlLevel();
    method @Deprecated public void resetCarrierCycles();
    method public void resetCarrierFrequencyHz();
    method @Deprecated public void resetCarrierPhase();
    method @Deprecated public void resetCarrierPhaseUncertainty();
    method public void resetCodeType();
    method public void resetSnrInDb();
    method public void set(android.location.GnssMeasurement);
    method public void setAccumulatedDeltaRangeMeters(double);
    method public void setAccumulatedDeltaRangeState(int);
    method public void setAccumulatedDeltaRangeUncertaintyMeters(double);
    method public void setAutomaticGainControlLevelInDb(double);
    method @Deprecated public void setCarrierCycles(long);
    method public void setCarrierFrequencyHz(float);
    method @Deprecated public void setCarrierPhase(double);
    method @Deprecated public void setCarrierPhaseUncertainty(double);
    method public void setCn0DbHz(double);
    method public void setCodeType(@NonNull String);
    method public void setConstellationType(int);
    method public void setMultipathIndicator(int);
    method public void setPseudorangeRateMetersPerSecond(double);
    method public void setPseudorangeRateUncertaintyMetersPerSecond(double);
    method public void setReceivedSvTimeNanos(long);
    method public void setReceivedSvTimeUncertaintyNanos(long);
    method public void setSnrInDb(double);
    method public void setState(int);
    method public void setSvid(int);
    method public void setTimeOffsetNanos(double);
    field public static final int ADR_STATE_ALL = 31; // 0x1f
  }

  public final class GnssMeasurementsEvent implements android.os.Parcelable {
    ctor public GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]);
  }

  public final class GnssNavigationMessage implements android.os.Parcelable {
    ctor public GnssNavigationMessage();
    method public void reset();
    method public void set(android.location.GnssNavigationMessage);
    method public void setData(byte[]);
    method public void setMessageId(int);
    method public void setStatus(int);
    method public void setSubmessageId(int);
    method public void setSvid(int);
    method public void setType(int);
  }

  public class Location implements android.os.Parcelable {
    method public void makeComplete();
  }

  public class LocationManager {
    method @NonNull public String[] getBackgroundThrottlingWhitelist();
    method @NonNull public String[] getIgnoreSettingsWhitelist();
    method @NonNull public java.util.List<android.location.LocationRequest> getTestProviderCurrentRequests(String);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, @NonNull android.os.UserHandle);
  }

  public final class LocationRequest implements android.os.Parcelable {
    method @NonNull public static android.location.LocationRequest create();
    method public int describeContents();
    method public long getExpireAt();
    method public long getFastestInterval();
    method public long getInterval();
    method public int getNumUpdates();
    method public int getQuality();
    method public boolean isLocationSettingsIgnored();
    method @NonNull public android.location.LocationRequest setExpireAt(long);
    method @NonNull public android.location.LocationRequest setExpireIn(long);
    method @NonNull public android.location.LocationRequest setFastestInterval(long);
    method @NonNull public android.location.LocationRequest setInterval(long);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @NonNull public android.location.LocationRequest setLocationSettingsIgnored(boolean);
    method @NonNull public android.location.LocationRequest setNumUpdates(int);
    method @NonNull public android.location.LocationRequest setProvider(@NonNull String);
    method @NonNull public android.location.LocationRequest setQuality(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACCURACY_BLOCK = 102; // 0x66
    field public static final int ACCURACY_CITY = 104; // 0x68
    field public static final int ACCURACY_FINE = 100; // 0x64
    field @NonNull public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
    field public static final int POWER_HIGH = 203; // 0xcb
    field public static final int POWER_LOW = 201; // 0xc9
    field public static final int POWER_NONE = 200; // 0xc8
  }

}

package android.media {

  public final class AudioFocusInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.media.AudioAttributes getAttributes();
    method @NonNull public String getClientId();
    method public int getClientUid();
    method public int getFlags();
    method public int getGainRequest();
    method public int getLossReceived();
    method @NonNull public String getPackageName();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioFocusInfo> CREATOR;
  }

  public final class AudioFocusRequest {
    method @Nullable public android.media.AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener();
  }

  public final class AudioFormat implements android.os.Parcelable {
    method public static int channelCountFromInChannelMask(int);
    method public static int channelCountFromOutChannelMask(int);
    method public static int getBytesPerSample(int);
    method public static boolean isEncodingLinearPcm(int);
  }

  public class AudioManager {
    method @RequiresPermission("android.permission.MODIFY_AUDIO_ROUTING") public int dispatchAudioFocusChange(@NonNull android.media.AudioFocusInfo, int, @NonNull android.media.audiopolicy.AudioPolicy);
    method public boolean hasRegisteredDynamicPolicy();
    method @RequiresPermission("android.permission.MODIFY_AUDIO_ROUTING") public int registerAudioPolicy(@NonNull android.media.audiopolicy.AudioPolicy);
    method @RequiresPermission("android.permission.MODIFY_AUDIO_ROUTING") public void setFocusRequestResult(@NonNull android.media.AudioFocusInfo, int, @NonNull android.media.audiopolicy.AudioPolicy);
    method @RequiresPermission("android.permission.MODIFY_AUDIO_ROUTING") public void unregisterAudioPolicy(@NonNull android.media.audiopolicy.AudioPolicy);
    method @RequiresPermission("android.permission.MODIFY_AUDIO_ROUTING") public void unregisterAudioPolicyAsync(@NonNull android.media.audiopolicy.AudioPolicy);
    field public static final int SUCCESS = 0; // 0x0
  }

  public static final class AudioRecord.MetricsConstants {
    field public static final String ATTRIBUTES = "android.media.audiorecord.attributes";
    field public static final String CHANNEL_MASK = "android.media.audiorecord.channelMask";
    field public static final String DURATION_MS = "android.media.audiorecord.durationMs";
    field public static final String FRAME_COUNT = "android.media.audiorecord.frameCount";
    field public static final String PORT_ID = "android.media.audiorecord.portId";
    field public static final String START_COUNT = "android.media.audiorecord.startCount";
  }

  public final class AudioRecordingConfiguration implements android.os.Parcelable {
    ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]);
    ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String);
  }

  public static final class AudioTrack.MetricsConstants {
    field public static final String ATTRIBUTES = "android.media.audiotrack.attributes";
    field public static final String CHANNEL_MASK = "android.media.audiotrack.channelMask";
    field public static final String ENCODING = "android.media.audiotrack.encoding";
    field public static final String FRAME_COUNT = "android.media.audiotrack.frameCount";
    field public static final String PORT_ID = "android.media.audiotrack.portId";
    field public static final String SAMPLE_RATE = "android.media.audiotrack.sampleRate";
  }

  public static final class MediaCodecInfo.VideoCapabilities.PerformancePoint {
    ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(int, int, int, int, @NonNull android.util.Size);
    ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(@NonNull android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint, @NonNull android.util.Size);
    method public int getMaxFrameRate();
    method public long getMaxMacroBlockRate();
    method public int getMaxMacroBlocks();
  }

  public final class PlaybackParams implements android.os.Parcelable {
    method public int getAudioStretchMode();
    method public android.media.PlaybackParams setAudioStretchMode(int);
  }

  public static final class VolumeShaper.Configuration.Builder {
    method @NonNull public android.media.VolumeShaper.Configuration.Builder setOptionFlags(int);
  }

}

package android.media.audiofx {

  public class AudioEffect {
    method public static int byteArrayToInt(byte[]);
    method public static short byteArrayToShort(byte[]);
    method public int getParameter(byte[], byte[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, byte[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, int[]) throws java.lang.IllegalStateException;
    method public int getParameter(int, short[]) throws java.lang.IllegalStateException;
    method public int getParameter(int[], short[]) throws java.lang.IllegalStateException;
    method public static byte[] intToByteArray(int);
    method public static boolean isEffectTypeAvailable(java.util.UUID);
    method public static boolean isError(int);
    method public int setParameter(byte[], byte[]) throws java.lang.IllegalStateException;
    method public int setParameter(int, int) throws java.lang.IllegalStateException;
    method public int setParameter(int, short) throws java.lang.IllegalStateException;
    method public int setParameter(int, byte[]) throws java.lang.IllegalStateException;
    method public int setParameter(int[], int[]) throws java.lang.IllegalStateException;
    method public int setParameter(int[], byte[]) throws java.lang.IllegalStateException;
    method public void setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener);
    method public static byte[] shortToByteArray(short);
    field public static final java.util.UUID EFFECT_TYPE_NULL;
  }

  public static class AudioEffect.Descriptor {
    ctor public AudioEffect.Descriptor(android.os.Parcel);
    method public void writeToParcel(android.os.Parcel);
  }

  public static interface AudioEffect.OnParameterChangeListener {
    method public void onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]);
  }

}

package android.media.audiopolicy {

  public class AudioMix {
    method public int getMixState();
    field public static final int MIX_STATE_DISABLED = -1; // 0xffffffff
    field public static final int MIX_STATE_IDLE = 0; // 0x0
    field public static final int MIX_STATE_MIXING = 1; // 0x1
    field public static final int ROUTE_FLAG_LOOP_BACK = 2; // 0x2
    field public static final int ROUTE_FLAG_RENDER = 1; // 0x1
  }

  public static class AudioMix.Builder {
    ctor public AudioMix.Builder(android.media.audiopolicy.AudioMixingRule) throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMix build() throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMix.Builder setDevice(@NonNull android.media.AudioDeviceInfo) throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMix.Builder setFormat(android.media.AudioFormat) throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMix.Builder setRouteFlags(int) throws java.lang.IllegalArgumentException;
  }

  public class AudioMixingRule {
    field public static final int RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET = 2; // 0x2
    field public static final int RULE_MATCH_ATTRIBUTE_USAGE = 1; // 0x1
    field public static final int RULE_MATCH_UID = 4; // 0x4
  }

  public static class AudioMixingRule.Builder {
    ctor public AudioMixingRule.Builder();
    method public android.media.audiopolicy.AudioMixingRule.Builder addMixRule(int, Object) throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMixingRule.Builder addRule(android.media.AudioAttributes, int) throws java.lang.IllegalArgumentException;
    method @NonNull public android.media.audiopolicy.AudioMixingRule.Builder allowPrivilegedPlaybackCapture(boolean);
    method public android.media.audiopolicy.AudioMixingRule build();
    method public android.media.audiopolicy.AudioMixingRule.Builder excludeMixRule(int, Object) throws java.lang.IllegalArgumentException;
    method public android.media.audiopolicy.AudioMixingRule.Builder excludeRule(android.media.AudioAttributes, int) throws java.lang.IllegalArgumentException;
  }

  public class AudioPolicy {
    method public int attachMixes(@NonNull java.util.List<android.media.audiopolicy.AudioMix>);
    method public android.media.AudioRecord createAudioRecordSink(android.media.audiopolicy.AudioMix) throws java.lang.IllegalArgumentException;
    method public android.media.AudioTrack createAudioTrackSource(android.media.audiopolicy.AudioMix) throws java.lang.IllegalArgumentException;
    method public int detachMixes(@NonNull java.util.List<android.media.audiopolicy.AudioMix>);
    method public int getFocusDuckingBehavior();
    method public int getStatus();
    method public boolean removeUidDeviceAffinity(int);
    method public int setFocusDuckingBehavior(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
    method public void setRegistration(String);
    method public boolean setUidDeviceAffinity(int, @NonNull java.util.List<android.media.AudioDeviceInfo>);
    method public String toLogFriendlyString();
    field public static final int FOCUS_POLICY_DUCKING_DEFAULT = 0; // 0x0
    field public static final int FOCUS_POLICY_DUCKING_IN_APP = 0; // 0x0
    field public static final int FOCUS_POLICY_DUCKING_IN_POLICY = 1; // 0x1
    field public static final int POLICY_STATUS_REGISTERED = 2; // 0x2
    field public static final int POLICY_STATUS_UNREGISTERED = 1; // 0x1
  }

  public abstract static class AudioPolicy.AudioPolicyFocusListener {
    ctor public AudioPolicy.AudioPolicyFocusListener();
    method public void onAudioFocusAbandon(android.media.AudioFocusInfo);
    method public void onAudioFocusGrant(android.media.AudioFocusInfo, int);
    method public void onAudioFocusLoss(android.media.AudioFocusInfo, boolean);
    method public void onAudioFocusRequest(android.media.AudioFocusInfo, int);
  }

  public abstract static class AudioPolicy.AudioPolicyStatusListener {
    ctor public AudioPolicy.AudioPolicyStatusListener();
    method public void onMixStateUpdate(android.media.audiopolicy.AudioMix);
    method public void onStatusChange();
  }

  public abstract static class AudioPolicy.AudioPolicyVolumeCallback {
    ctor public AudioPolicy.AudioPolicyVolumeCallback();
    method public void onVolumeAdjustment(int);
  }

  public static class AudioPolicy.Builder {
    ctor public AudioPolicy.Builder(android.content.Context);
    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder addMix(@NonNull android.media.audiopolicy.AudioMix) throws java.lang.IllegalArgumentException;
    method @NonNull public android.media.audiopolicy.AudioPolicy build();
    method public void setAudioPolicyFocusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener);
    method public void setAudioPolicyStatusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener);
    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder setAudioPolicyVolumeCallback(@NonNull android.media.audiopolicy.AudioPolicy.AudioPolicyVolumeCallback);
    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder setIsAudioFocusPolicy(boolean);
    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder setIsTestFocusPolicy(boolean);
    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder setLooper(@NonNull android.os.Looper) throws java.lang.IllegalArgumentException;
  }

}

package android.metrics {

  public class LogMaker {
    ctor public LogMaker(int);
    ctor public LogMaker(Object[]);
    method public android.metrics.LogMaker addTaggedData(int, Object);
    method public android.metrics.LogMaker clearCategory();
    method public android.metrics.LogMaker clearPackageName();
    method public android.metrics.LogMaker clearSubtype();
    method public android.metrics.LogMaker clearTaggedData(int);
    method public android.metrics.LogMaker clearType();
    method public void deserialize(Object[]);
    method public int getCategory();
    method public long getCounterBucket();
    method public String getCounterName();
    method public int getCounterValue();
    method public String getPackageName();
    method public int getProcessId();
    method public int getSubtype();
    method public Object getTaggedData(int);
    method public long getTimestamp();
    method public int getType();
    method public int getUid();
    method public boolean isLongCounterBucket();
    method public boolean isSubsetOf(android.metrics.LogMaker);
    method public boolean isValidValue(Object);
    method public Object[] serialize();
    method public android.metrics.LogMaker setCategory(int);
    method public android.metrics.LogMaker setPackageName(String);
    method public android.metrics.LogMaker setSubtype(int);
    method public android.metrics.LogMaker setType(int);
  }

  public class MetricsReader {
    ctor public MetricsReader();
    method public void checkpoint();
    method public boolean hasNext();
    method public android.metrics.LogMaker next();
    method public void read(long);
    method public void reset();
  }

}

package android.net {

  public class CaptivePortal implements android.os.Parcelable {
    method public void logEvent(int, @NonNull String);
    method public void useNetwork();
    field public static final int APP_RETURN_DISMISSED = 0; // 0x0
    field public static final int APP_RETURN_UNWANTED = 1; // 0x1
    field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2
  }

  public class ConnectivityManager {
    method @RequiresPermission(android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) public void startCaptivePortalApp(@NonNull android.net.Network, @NonNull android.os.Bundle);
    field public static final String EXTRA_CAPTIVE_PORTAL_PROBE_SPEC = "android.net.extra.CAPTIVE_PORTAL_PROBE_SPEC";
    field public static final String EXTRA_CAPTIVE_PORTAL_USER_AGENT = "android.net.extra.CAPTIVE_PORTAL_USER_AGENT";
  }

  public final class IpPrefix implements android.os.Parcelable {
    ctor public IpPrefix(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int);
    ctor public IpPrefix(@NonNull String);
  }

  public final class IpSecManager {
    field public static final int INVALID_SECURITY_PARAMETER_INDEX = 0; // 0x0
  }

  public class LinkAddress implements android.os.Parcelable {
    ctor public LinkAddress(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int, int, int);
    ctor public LinkAddress(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int);
    ctor public LinkAddress(@NonNull String);
    ctor public LinkAddress(@NonNull String, int, int);
    method public boolean isGlobalPreferred();
    method public boolean isIpv4();
    method public boolean isIpv6();
    method public boolean isSameAddressAs(@Nullable android.net.LinkAddress);
  }

  public final class LinkProperties implements android.os.Parcelable {
    ctor public LinkProperties(@Nullable android.net.LinkProperties);
    method public boolean addDnsServer(@NonNull java.net.InetAddress);
    method public boolean addLinkAddress(@NonNull android.net.LinkAddress);
    method @Nullable public android.net.IpPrefix getNat64Prefix();
    method @NonNull public java.util.List<java.net.InetAddress> getPcscfServers();
    method @Nullable public String getTcpBufferSizes();
    method @NonNull public java.util.List<java.net.InetAddress> getValidatedPrivateDnsServers();
    method public boolean hasGlobalIpv6Address();
    method public boolean hasIpv4Address();
    method public boolean hasIpv6DefaultRoute();
    method public boolean isIpv4Provisioned();
    method public boolean isIpv6Provisioned();
    method public boolean isProvisioned();
    method public boolean isReachable(@NonNull java.net.InetAddress);
    method public boolean removeDnsServer(@NonNull java.net.InetAddress);
    method public boolean removeLinkAddress(@NonNull android.net.LinkAddress);
    method public boolean removeRoute(@NonNull android.net.RouteInfo);
    method public void setNat64Prefix(@Nullable android.net.IpPrefix);
    method public void setPcscfServers(@NonNull java.util.Collection<java.net.InetAddress>);
    method public void setPrivateDnsServerName(@Nullable String);
    method public void setTcpBufferSizes(@Nullable String);
    method public void setUsePrivateDns(boolean);
    method public void setValidatedPrivateDnsServers(@NonNull java.util.Collection<java.net.InetAddress>);
  }

  public class Network implements android.os.Parcelable {
    ctor public Network(@NonNull android.net.Network);
    method @NonNull public android.net.Network getPrivateDnsBypassingCopy();
  }

  public final class NetworkCapabilities implements android.os.Parcelable {
    method public int[] getCapabilities();
    method @NonNull public int[] getTransportTypes();
    method public boolean satisfiedByNetworkCapabilities(@Nullable android.net.NetworkCapabilities);
    field public static final int TRANSPORT_TEST = 7; // 0x7
  }

  public class NetworkStack {
    field public static final String PERMISSION_MAINLINE_NETWORK_STACK = "android.permission.MAINLINE_NETWORK_STACK";
  }

  public final class RouteInfo implements android.os.Parcelable {
    ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int);
    method public int getType();
    field public static final int RTN_THROW = 9; // 0x9
    field public static final int RTN_UNICAST = 1; // 0x1
    field public static final int RTN_UNREACHABLE = 7; // 0x7
  }

  public final class StaticIpConfiguration implements android.os.Parcelable {
    ctor public StaticIpConfiguration();
    ctor public StaticIpConfiguration(@Nullable android.net.StaticIpConfiguration);
    method public void addDnsServer(@NonNull java.net.InetAddress);
    method public void clear();
    method public int describeContents();
    method @NonNull public java.util.List<java.net.InetAddress> getDnsServers();
    method @Nullable public String getDomains();
    method @Nullable public java.net.InetAddress getGateway();
    method @Nullable public android.net.LinkAddress getIpAddress();
    method @NonNull public java.util.List<android.net.RouteInfo> getRoutes(@Nullable String);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
  }

  public static final class StaticIpConfiguration.Builder {
    ctor public StaticIpConfiguration.Builder();
    method @NonNull public android.net.StaticIpConfiguration build();
    method @NonNull public android.net.StaticIpConfiguration.Builder setDnsServers(@NonNull Iterable<java.net.InetAddress>);
    method @NonNull public android.net.StaticIpConfiguration.Builder setDomains(@Nullable String);
    method @NonNull public android.net.StaticIpConfiguration.Builder setGateway(@Nullable java.net.InetAddress);
    method @NonNull public android.net.StaticIpConfiguration.Builder setIpAddress(@Nullable android.net.LinkAddress);
  }

  public final class TestNetworkInterface implements android.os.Parcelable {
    ctor public TestNetworkInterface(android.os.ParcelFileDescriptor, String);
    method public int describeContents();
    method public android.os.ParcelFileDescriptor getFileDescriptor();
    method public String getInterfaceName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.TestNetworkInterface> CREATOR;
  }

  public class TestNetworkManager {
    method public android.net.TestNetworkInterface createTapInterface();
    method public android.net.TestNetworkInterface createTunInterface(@NonNull android.net.LinkAddress[]);
    method public void setupTestNetwork(@NonNull String, @NonNull android.os.IBinder);
    method public void teardownTestNetwork(@NonNull android.net.Network);
  }

  public class TrafficStats {
    method public static long getLoopbackRxBytes();
    method public static long getLoopbackRxPackets();
    method public static long getLoopbackTxBytes();
    method public static long getLoopbackTxPackets();
  }

}

package android.net.apf {

  public final class ApfCapabilities implements android.os.Parcelable {
    ctor public ApfCapabilities(int, int, int);
    method public int describeContents();
    method public static boolean getApfDrop8023Frames();
    method @NonNull public static int[] getApfEtherTypeBlackList();
    method public boolean hasDataAccess();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.apf.ApfCapabilities> CREATOR;
    field public final int apfPacketFormat;
    field public final int apfVersionSupported;
    field public final int maximumApfProgramSize;
  }

}

package android.net.metrics {

  public final class ApfProgramEvent implements android.net.metrics.IpConnectivityLog.Event {
  }

  public static final class ApfProgramEvent.Builder {
    ctor public ApfProgramEvent.Builder();
    method @NonNull public android.net.metrics.ApfProgramEvent build();
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setActualLifetime(long);
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setCurrentRas(int);
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setFilteredRas(int);
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setFlags(boolean, boolean);
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setLifetime(long);
    method @NonNull public android.net.metrics.ApfProgramEvent.Builder setProgramLength(int);
  }

  public final class ApfStats implements android.net.metrics.IpConnectivityLog.Event {
  }

  public static final class ApfStats.Builder {
    ctor public ApfStats.Builder();
    method @NonNull public android.net.metrics.ApfStats build();
    method @NonNull public android.net.metrics.ApfStats.Builder setDroppedRas(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setDurationMs(long);
    method @NonNull public android.net.metrics.ApfStats.Builder setMatchingRas(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setMaxProgramSize(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setParseErrors(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setProgramUpdates(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setProgramUpdatesAll(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setProgramUpdatesAllowingMulticast(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setReceivedRas(int);
    method @NonNull public android.net.metrics.ApfStats.Builder setZeroLifetimeRas(int);
  }

  public final class DhcpClientEvent implements android.net.metrics.IpConnectivityLog.Event {
  }

  public static final class DhcpClientEvent.Builder {
    ctor public DhcpClientEvent.Builder();
    method @NonNull public android.net.metrics.DhcpClientEvent build();
    method @NonNull public android.net.metrics.DhcpClientEvent.Builder setDurationMs(int);
    method @NonNull public android.net.metrics.DhcpClientEvent.Builder setMsg(String);
  }

  public final class DhcpErrorEvent implements android.net.metrics.IpConnectivityLog.Event {
    ctor public DhcpErrorEvent(int);
    method public static int errorCodeWithOption(int, int);
    field public static final int BOOTP_TOO_SHORT = 67174400; // 0x4010000
    field public static final int BUFFER_UNDERFLOW = 83951616; // 0x5010000
    field public static final int DHCP_BAD_MAGIC_COOKIE = 67239936; // 0x4020000
    field public static final int DHCP_ERROR = 4; // 0x4
    field public static final int DHCP_INVALID_OPTION_LENGTH = 67305472; // 0x4030000
    field public static final int DHCP_NO_COOKIE = 67502080; // 0x4060000
    field public static final int DHCP_NO_MSG_TYPE = 67371008; // 0x4040000
    field public static final int DHCP_UNKNOWN_MSG_TYPE = 67436544; // 0x4050000
    field public static final int L2_ERROR = 1; // 0x1
    field public static final int L2_TOO_SHORT = 16842752; // 0x1010000
    field public static final int L2_WRONG_ETH_TYPE = 16908288; // 0x1020000
    field public static final int L3_ERROR = 2; // 0x2
    field public static final int L3_INVALID_IP = 33751040; // 0x2030000
    field public static final int L3_NOT_IPV4 = 33685504; // 0x2020000
    field public static final int L3_TOO_SHORT = 33619968; // 0x2010000
    field public static final int L4_ERROR = 3; // 0x3
    field public static final int L4_NOT_UDP = 50397184; // 0x3010000
    field public static final int L4_WRONG_PORT = 50462720; // 0x3020000
    field public static final int MISC_ERROR = 5; // 0x5
    field public static final int PARSING_ERROR = 84082688; // 0x5030000
    field public static final int RECEIVE_ERROR = 84017152; // 0x5020000
  }

  public class IpConnectivityLog {
    ctor public IpConnectivityLog();
    method public boolean log(long, @NonNull android.net.metrics.IpConnectivityLog.Event);
    method public boolean log(@NonNull String, @NonNull android.net.metrics.IpConnectivityLog.Event);
    method public boolean log(@NonNull android.net.Network, @NonNull int[], @NonNull android.net.metrics.IpConnectivityLog.Event);
    method public boolean log(int, @NonNull int[], @NonNull android.net.metrics.IpConnectivityLog.Event);
    method public boolean log(@NonNull android.net.metrics.IpConnectivityLog.Event);
  }

  public static interface IpConnectivityLog.Event extends android.os.Parcelable {
  }

  public final class IpManagerEvent implements android.net.metrics.IpConnectivityLog.Event {
    ctor public IpManagerEvent(int, long);
    field public static final int COMPLETE_LIFECYCLE = 3; // 0x3
    field public static final int ERROR_INTERFACE_NOT_FOUND = 8; // 0x8
    field public static final int ERROR_INVALID_PROVISIONING = 7; // 0x7
    field public static final int ERROR_STARTING_IPREACHABILITYMONITOR = 6; // 0x6
    field public static final int ERROR_STARTING_IPV4 = 4; // 0x4
    field public static final int ERROR_STARTING_IPV6 = 5; // 0x5
    field public static final int PROVISIONING_FAIL = 2; // 0x2
    field public static final int PROVISIONING_OK = 1; // 0x1
  }

  public final class IpReachabilityEvent implements android.net.metrics.IpConnectivityLog.Event {
    ctor public IpReachabilityEvent(int);
    field public static final int NUD_FAILED = 512; // 0x200
    field public static final int NUD_FAILED_ORGANIC = 1024; // 0x400
    field public static final int PROBE = 256; // 0x100
    field public static final int PROVISIONING_LOST = 768; // 0x300
    field public static final int PROVISIONING_LOST_ORGANIC = 1280; // 0x500
  }

  public final class NetworkEvent implements android.net.metrics.IpConnectivityLog.Event {
    ctor public NetworkEvent(int, long);
    ctor public NetworkEvent(int);
    field public static final int NETWORK_CAPTIVE_PORTAL_FOUND = 4; // 0x4
    field public static final int NETWORK_CONNECTED = 1; // 0x1
    field public static final int NETWORK_CONSECUTIVE_DNS_TIMEOUT_FOUND = 12; // 0xc
    field public static final int NETWORK_DISCONNECTED = 7; // 0x7
    field public static final int NETWORK_FIRST_VALIDATION_PORTAL_FOUND = 10; // 0xa
    field public static final int NETWORK_FIRST_VALIDATION_SUCCESS = 8; // 0x8
    field public static final int NETWORK_LINGER = 5; // 0x5
    field public static final int NETWORK_PARTIAL_CONNECTIVITY = 13; // 0xd
    field public static final int NETWORK_REVALIDATION_PORTAL_FOUND = 11; // 0xb
    field public static final int NETWORK_REVALIDATION_SUCCESS = 9; // 0x9
    field public static final int NETWORK_UNLINGER = 6; // 0x6
    field public static final int NETWORK_VALIDATED = 2; // 0x2
    field public static final int NETWORK_VALIDATION_FAILED = 3; // 0x3
  }

  public final class RaEvent implements android.net.metrics.IpConnectivityLog.Event {
  }

  public static final class RaEvent.Builder {
    ctor public RaEvent.Builder();
    method @NonNull public android.net.metrics.RaEvent build();
    method @NonNull public android.net.metrics.RaEvent.Builder updateDnsslLifetime(long);
    method @NonNull public android.net.metrics.RaEvent.Builder updatePrefixPreferredLifetime(long);
    method @NonNull public android.net.metrics.RaEvent.Builder updatePrefixValidLifetime(long);
    method @NonNull public android.net.metrics.RaEvent.Builder updateRdnssLifetime(long);
    method @NonNull public android.net.metrics.RaEvent.Builder updateRouteInfoLifetime(long);
    method @NonNull public android.net.metrics.RaEvent.Builder updateRouterLifetime(long);
  }

  public final class ValidationProbeEvent implements android.net.metrics.IpConnectivityLog.Event {
    method @NonNull public static String getProbeName(int);
    field public static final int DNS_FAILURE = 0; // 0x0
    field public static final int DNS_SUCCESS = 1; // 0x1
    field public static final int PROBE_DNS = 0; // 0x0
    field public static final int PROBE_FALLBACK = 4; // 0x4
    field public static final int PROBE_HTTP = 1; // 0x1
    field public static final int PROBE_HTTPS = 2; // 0x2
    field public static final int PROBE_PAC = 3; // 0x3
    field public static final int PROBE_PRIVDNS = 5; // 0x5
  }

  public static final class ValidationProbeEvent.Builder {
    ctor public ValidationProbeEvent.Builder();
    method @NonNull public android.net.metrics.ValidationProbeEvent build();
    method @NonNull public android.net.metrics.ValidationProbeEvent.Builder setDurationMs(long);
    method @NonNull public android.net.metrics.ValidationProbeEvent.Builder setProbeType(int, boolean);
    method @NonNull public android.net.metrics.ValidationProbeEvent.Builder setReturnCode(int);
  }

}

package android.net.util {

  public final class SocketUtils {
    method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
    method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
    method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
  }

}

package android.os {

  public class BatteryManager {
    method @RequiresPermission("android.permission.POWER_SAVER") public boolean setChargingStateUpdateDelayMillis(int);
  }

  public final class BugreportManager {
    method @RequiresPermission(android.Manifest.permission.DUMP) public void cancelBugreport();
    method @RequiresPermission(android.Manifest.permission.DUMP) public void startBugreport(@NonNull android.os.ParcelFileDescriptor, @Nullable android.os.ParcelFileDescriptor, @NonNull android.os.BugreportParams, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
  }

  public abstract static class BugreportManager.BugreportCallback {
    ctor public BugreportManager.BugreportCallback();
    method public void onError(int);
    method public void onFinished();
    method public void onProgress(@FloatRange(from=0.0f, to=100.0f) float);
    field public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; // 0x5
    field public static final int BUGREPORT_ERROR_INVALID_INPUT = 1; // 0x1
    field public static final int BUGREPORT_ERROR_RUNTIME = 2; // 0x2
    field public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT = 4; // 0x4
    field public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT = 3; // 0x3
  }

  public final class BugreportParams {
    ctor public BugreportParams(int);
    method public int getMode();
    field public static final int BUGREPORT_MODE_FULL = 0; // 0x0
    field public static final int BUGREPORT_MODE_INTERACTIVE = 1; // 0x1
    field public static final int BUGREPORT_MODE_REMOTE = 2; // 0x2
    field public static final int BUGREPORT_MODE_TELEPHONY = 4; // 0x4
    field public static final int BUGREPORT_MODE_WEAR = 3; // 0x3
    field public static final int BUGREPORT_MODE_WIFI = 5; // 0x5
  }

  public class Build {
    method public static boolean is64BitAbi(String);
    field public static final boolean IS_EMULATOR;
  }

  public static class Build.VERSION {
    field public static final String[] ACTIVE_CODENAMES;
    field public static final int FIRST_SDK_INT;
    field public static final int RESOURCES_SDK_INT;
  }

  public class DeviceIdleManager {
    method @NonNull public String[] getSystemPowerWhitelist();
    method @NonNull public String[] getSystemPowerWhitelistExceptIdle();
  }

  public class Environment {
    method public static java.io.File buildPath(java.io.File, java.lang.String...);
    method @NonNull public static java.io.File getProductDirectory();
    method @NonNull public static java.io.File getStorageDirectory();
  }

  public final class FileUtils {
    method public static boolean contains(java.io.File, java.io.File);
  }

  public abstract class HwBinder implements android.os.IHwBinder {
    ctor public HwBinder();
    method public static final void configureRpcThreadpool(long, boolean);
    method public static void enableInstrumentation();
    method public static final android.os.IHwBinder getService(String, String) throws java.util.NoSuchElementException, android.os.RemoteException;
    method public static final android.os.IHwBinder getService(String, String, boolean) throws java.util.NoSuchElementException, android.os.RemoteException;
    method public static final void joinRpcThreadpool();
    method public abstract void onTransact(int, android.os.HwParcel, android.os.HwParcel, int) throws android.os.RemoteException;
    method public final void registerService(String) throws android.os.RemoteException;
    method public final void transact(int, android.os.HwParcel, android.os.HwParcel, int) throws android.os.RemoteException;
  }

  public class HwBlob {
    ctor public HwBlob(int);
    method public final void copyToBoolArray(long, boolean[], int);
    method public final void copyToDoubleArray(long, double[], int);
    method public final void copyToFloatArray(long, float[], int);
    method public final void copyToInt16Array(long, short[], int);
    method public final void copyToInt32Array(long, int[], int);
    method public final void copyToInt64Array(long, long[], int);
    method public final void copyToInt8Array(long, byte[], int);
    method public final boolean getBool(long);
    method public final double getDouble(long);
    method public final float getFloat(long);
    method public final short getInt16(long);
    method public final int getInt32(long);
    method public final long getInt64(long);
    method public final byte getInt8(long);
    method public final String getString(long);
    method public final long handle();
    method public final void putBlob(long, android.os.HwBlob);
    method public final void putBool(long, boolean);
    method public final void putBoolArray(long, boolean[]);
    method public final void putDouble(long, double);
    method public final void putDoubleArray(long, double[]);
    method public final void putFloat(long, float);
    method public final void putFloatArray(long, float[]);
    method public final void putInt16(long, short);
    method public final void putInt16Array(long, short[]);
    method public final void putInt32(long, int);
    method public final void putInt32Array(long, int[]);
    method public final void putInt64(long, long);
    method public final void putInt64Array(long, long[]);
    method public final void putInt8(long, byte);
    method public final void putInt8Array(long, byte[]);
    method public final void putNativeHandle(long, @Nullable android.os.NativeHandle);
    method public final void putString(long, String);
    method public static Boolean[] wrapArray(@NonNull boolean[]);
    method public static Long[] wrapArray(@NonNull long[]);
    method public static Byte[] wrapArray(@NonNull byte[]);
    method public static Short[] wrapArray(@NonNull short[]);
    method public static Integer[] wrapArray(@NonNull int[]);
    method public static Float[] wrapArray(@NonNull float[]);
    method public static Double[] wrapArray(@NonNull double[]);
  }

  public class HwParcel {
    ctor public HwParcel();
    method public final void enforceInterface(String);
    method public final boolean readBool();
    method public final java.util.ArrayList<java.lang.Boolean> readBoolVector();
    method public final android.os.HwBlob readBuffer(long);
    method public final double readDouble();
    method public final java.util.ArrayList<java.lang.Double> readDoubleVector();
    method public final android.os.HwBlob readEmbeddedBuffer(long, long, long, boolean);
    method @Nullable public final android.os.NativeHandle readEmbeddedNativeHandle(long, long);
    method public final float readFloat();
    method public final java.util.ArrayList<java.lang.Float> readFloatVector();
    method public final short readInt16();
    method public final java.util.ArrayList<java.lang.Short> readInt16Vector();
    method public final int readInt32();
    method public final java.util.ArrayList<java.lang.Integer> readInt32Vector();
    method public final long readInt64();
    method public final java.util.ArrayList<java.lang.Long> readInt64Vector();
    method public final byte readInt8();
    method public final java.util.ArrayList<java.lang.Byte> readInt8Vector();
    method @Nullable public final android.os.NativeHandle readNativeHandle();
    method @NonNull public final java.util.ArrayList<android.os.NativeHandle> readNativeHandleVector();
    method public final String readString();
    method public final java.util.ArrayList<java.lang.String> readStringVector();
    method public final android.os.IHwBinder readStrongBinder();
    method public final void release();
    method public final void releaseTemporaryStorage();
    method public final void send();
    method public final void verifySuccess();
    method public final void writeBool(boolean);
    method public final void writeBoolVector(java.util.ArrayList<java.lang.Boolean>);
    method public final void writeBuffer(android.os.HwBlob);
    method public final void writeDouble(double);
    method public final void writeDoubleVector(java.util.ArrayList<java.lang.Double>);
    method public final void writeFloat(float);
    method public final void writeFloatVector(java.util.ArrayList<java.lang.Float>);
    method public final void writeInt16(short);
    method public final void writeInt16Vector(java.util.ArrayList<java.lang.Short>);
    method public final void writeInt32(int);
    method public final void writeInt32Vector(java.util.ArrayList<java.lang.Integer>);
    method public final void writeInt64(long);
    method public final void writeInt64Vector(java.util.ArrayList<java.lang.Long>);
    method public final void writeInt8(byte);
    method public final void writeInt8Vector(java.util.ArrayList<java.lang.Byte>);
    method public final void writeInterfaceToken(String);
    method public final void writeNativeHandle(@Nullable android.os.NativeHandle);
    method public final void writeNativeHandleVector(@NonNull java.util.ArrayList<android.os.NativeHandle>);
    method public final void writeStatus(int);
    method public final void writeString(String);
    method public final void writeStringVector(java.util.ArrayList<java.lang.String>);
    method public final void writeStrongBinder(android.os.IHwBinder);
    field public static final int STATUS_SUCCESS = 0; // 0x0
  }

  @IntDef(prefix={"STATUS_"}, value={android.os.HwParcel.STATUS_SUCCESS}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface HwParcel.Status {
  }

  public interface IHwBinder {
    method public boolean linkToDeath(android.os.IHwBinder.DeathRecipient, long);
    method public android.os.IHwInterface queryLocalInterface(String);
    method public void transact(int, android.os.HwParcel, android.os.HwParcel, int) throws android.os.RemoteException;
    method public boolean unlinkToDeath(android.os.IHwBinder.DeathRecipient);
  }

  public static interface IHwBinder.DeathRecipient {
    method public void serviceDied(long);
  }

  public interface IHwInterface {
    method public android.os.IHwBinder asBinder();
  }

  public class IncidentManager {
    method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public void approveReport(android.net.Uri);
    method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void cancelAuthorization(android.os.IncidentManager.AuthListener);
    method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void deleteIncidentReports(android.net.Uri);
    method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public void denyReport(android.net.Uri);
    method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @Nullable public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
    method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @NonNull public java.util.List<android.net.Uri> getIncidentReportList(String);
    method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public java.util.List<android.os.IncidentManager.PendingReport> getPendingReports();
    method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void reportIncident(android.os.IncidentReportArgs);
    method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener);
    field public static final int FLAG_CONFIRMATION_DIALOG = 1; // 0x1
    field public static final int PRIVACY_POLICY_AUTO = 200; // 0xc8
    field public static final int PRIVACY_POLICY_EXPLICIT = 100; // 0x64
    field public static final int PRIVACY_POLICY_LOCAL = 0; // 0x0
  }

  public static class IncidentManager.AuthListener {
    ctor public IncidentManager.AuthListener();
    method public void onReportApproved();
    method public void onReportDenied();
  }

  public static class IncidentManager.IncidentReport implements java.io.Closeable android.os.Parcelable {
    ctor public IncidentManager.IncidentReport(android.os.Parcel);
    method public void close();
    method public int describeContents();
    method public java.io.InputStream getInputStream() throws java.io.IOException;
    method public long getPrivacyPolicy();
    method public long getTimestamp();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentManager.IncidentReport> CREATOR;
  }

  public static class IncidentManager.PendingReport {
    ctor public IncidentManager.PendingReport(@NonNull android.net.Uri);
    method public int getFlags();
    method @NonNull public String getRequestingPackage();
    method public long getTimestamp();
    method @NonNull public android.net.Uri getUri();
  }

  public final class IncidentReportArgs implements android.os.Parcelable {
    ctor public IncidentReportArgs();
    ctor public IncidentReportArgs(android.os.Parcel);
    method public void addHeader(byte[]);
    method public void addSection(int);
    method public boolean containsSection(int);
    method public int describeContents();
    method public boolean isAll();
    method public void readFromParcel(android.os.Parcel);
    method public int sectionCount();
    method public void setAll(boolean);
    method public void setPrivacyPolicy(int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
  }

  public final class MessageQueue {
    method public int postSyncBarrier();
    method public void removeSyncBarrier(int);
  }

  public final class NativeHandle implements java.io.Closeable {
    ctor public NativeHandle();
    ctor public NativeHandle(@NonNull java.io.FileDescriptor, boolean);
    ctor public NativeHandle(@NonNull java.io.FileDescriptor[], @NonNull int[], boolean);
    method public void close() throws java.io.IOException;
    method @NonNull public android.os.NativeHandle dup() throws java.io.IOException;
    method @NonNull public java.io.FileDescriptor getFileDescriptor();
    method @NonNull public java.io.FileDescriptor[] getFileDescriptors();
    method @NonNull public int[] getInts();
    method public boolean hasSingleFileDescriptor();
  }

  public final class Parcel {
    method public int readExceptionCode();
  }

  public class ParcelFileDescriptor implements java.io.Closeable android.os.Parcelable {
    method public static java.io.File getFile(java.io.FileDescriptor) throws java.io.IOException;
  }

  public final class PowerManager {
    method @RequiresPermission("android.permission.POWER_SAVER") public int getPowerSaveModeTrigger();
    method @RequiresPermission("android.permission.POWER_SAVER") public boolean setDynamicPowerSaveHint(boolean, int);
    method @RequiresPermission(anyOf={"android.permission.DEVICE_POWER", "android.permission.POWER_SAVER"}) public boolean setPowerSaveModeEnabled(boolean);
    field public static final int POWER_SAVE_MODE_TRIGGER_DYNAMIC = 1; // 0x1
    field public static final int POWER_SAVE_MODE_TRIGGER_PERCENTAGE = 0; // 0x0
  }

  public class Process {
    method public static final int getThreadScheduler(int) throws java.lang.IllegalArgumentException;
    field public static final int FIRST_APP_ZYGOTE_ISOLATED_UID = 90000; // 0x15f90
    field public static final int FIRST_ISOLATED_UID = 99000; // 0x182b8
    field public static final int LAST_APP_ZYGOTE_ISOLATED_UID = 98999; // 0x182b7
    field public static final int LAST_ISOLATED_UID = 99999; // 0x1869f
    field public static final int NUM_UIDS_PER_APP_ZYGOTE = 100; // 0x64
  }

  public final class RemoteCallback implements android.os.Parcelable {
    ctor public RemoteCallback(android.os.RemoteCallback.OnResultListener);
    ctor public RemoteCallback(@NonNull android.os.RemoteCallback.OnResultListener, @Nullable android.os.Handler);
    method public int describeContents();
    method public void sendResult(@Nullable android.os.Bundle);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.RemoteCallback> CREATOR;
  }

  public static interface RemoteCallback.OnResultListener {
    method public void onResult(@Nullable android.os.Bundle);
  }

  public final class StrictMode {
    method public static void conditionallyCheckInstanceCounts();
    method public static void setViolationLogger(android.os.StrictMode.ViolationLogger);
  }

  public static final class StrictMode.ThreadPolicy.Builder {
    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
  }

  public static final class StrictMode.ViolationInfo implements android.os.Parcelable {
    ctor public StrictMode.ViolationInfo(android.os.Parcel);
    ctor public StrictMode.ViolationInfo(android.os.Parcel, boolean);
    method public int describeContents();
    method public void dump(android.util.Printer, String);
    method public String getStackTrace();
    method public Class<? extends android.os.strictmode.Violation> getViolationClass();
    method public String getViolationDetails();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.StrictMode.ViolationInfo> CREATOR;
    field public String broadcastIntentAction;
    field public int durationMillis;
    field public int numAnimationsRunning;
    field public long numInstances;
    field public String[] tags;
    field public int violationNumThisLoop;
    field public long violationUptimeMillis;
  }

  public static interface StrictMode.ViolationLogger {
    method public void log(android.os.StrictMode.ViolationInfo);
  }

  public class SystemProperties {
    method @NonNull public static String get(@NonNull String);
    method @NonNull public static String get(@NonNull String, @Nullable String);
    method public static boolean getBoolean(@NonNull String, boolean);
  }

  public final class UserHandle implements android.os.Parcelable {
    method public static int getAppId(int);
    method public int getIdentifier();
    method public static boolean isApp(int);
    field @NonNull public static final android.os.UserHandle ALL;
    field @NonNull public static final android.os.UserHandle CURRENT;
    field @NonNull public static final android.os.UserHandle SYSTEM;
  }

  public class UserManager {
    method public static boolean isSplitSystemUser();
    field public static final String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
  }

  public abstract class VibrationEffect implements android.os.Parcelable {
    method public static android.os.VibrationEffect get(int);
    method public static android.os.VibrationEffect get(int, boolean);
    method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context);
    method public abstract long getDuration();
    method protected static int scale(int, float, int);
    field public static final int EFFECT_POP = 4; // 0x4
    field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0
    field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1
    field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2
    field public static final int EFFECT_TEXTURE_TICK = 21; // 0x15
    field public static final int EFFECT_THUD = 3; // 0x3
    field public static final int[] RINGTONES;
  }

  public static class VibrationEffect.OneShot extends android.os.VibrationEffect implements android.os.Parcelable {
    ctor public VibrationEffect.OneShot(android.os.Parcel);
    ctor public VibrationEffect.OneShot(long, int);
    method public int getAmplitude();
    method public long getDuration();
    method public android.os.VibrationEffect.OneShot scale(float, int);
    method public void validate();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.OneShot> CREATOR;
  }

  public static class VibrationEffect.Prebaked extends android.os.VibrationEffect implements android.os.Parcelable {
    ctor public VibrationEffect.Prebaked(android.os.Parcel);
    ctor public VibrationEffect.Prebaked(int, boolean);
    method public long getDuration();
    method public int getEffectStrength();
    method public int getId();
    method public void setEffectStrength(int);
    method public boolean shouldFallback();
    method public void validate();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Prebaked> CREATOR;
  }

  public static class VibrationEffect.Waveform extends android.os.VibrationEffect implements android.os.Parcelable {
    ctor public VibrationEffect.Waveform(android.os.Parcel);
    ctor public VibrationEffect.Waveform(long[], int[], int);
    method public int[] getAmplitudes();
    method public long getDuration();
    method public int getRepeatIndex();
    method public long[] getTimings();
    method public android.os.VibrationEffect.Waveform scale(float, int);
    method public void validate();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Waveform> CREATOR;
  }

  public class VintfObject {
    method public static String[] getHalNamesAndVersions();
    method public static String getSepolicyVersion();
    method public static Long getTargetFrameworkCompatibilityMatrixVersion();
    method public static java.util.Map<java.lang.String,java.lang.String[]> getVndkSnapshots();
    method public static String[] report();
  }

  public class VintfRuntimeInfo {
    method public static String getCpuInfo();
    method public static String getHardwareId();
    method public static String getKernelVersion();
    method public static String getNodeName();
    method public static String getOsName();
    method public static String getOsRelease();
    method public static String getOsVersion();
  }

  public class WorkSource implements android.os.Parcelable {
    ctor public WorkSource(int);
    method public boolean add(int);
    method public boolean add(int, String);
    method @Deprecated public android.os.WorkSource addReturningNewbs(android.os.WorkSource);
    method public int get(int);
    method public String getName(int);
    method @Deprecated public android.os.WorkSource[] setReturningDiffs(android.os.WorkSource);
    method public int size();
  }

}

package android.os.health {

  public class HealthKeys {
    ctor public HealthKeys();
    field public static final int BASE_PACKAGE = 40000; // 0x9c40
    field public static final int BASE_PID = 20000; // 0x4e20
    field public static final int BASE_PROCESS = 30000; // 0x7530
    field public static final int BASE_SERVICE = 50000; // 0xc350
    field public static final int BASE_UID = 10000; // 0x2710
    field public static final int TYPE_COUNT = 5; // 0x5
    field public static final int TYPE_MEASUREMENT = 1; // 0x1
    field public static final int TYPE_MEASUREMENTS = 4; // 0x4
    field public static final int TYPE_STATS = 2; // 0x2
    field public static final int TYPE_TIMER = 0; // 0x0
    field public static final int TYPE_TIMERS = 3; // 0x3
    field public static final int UNKNOWN_KEY = 0; // 0x0
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) public static @interface HealthKeys.Constant {
    method public abstract int type();
  }

  public static class HealthKeys.Constants {
    ctor public HealthKeys.Constants(Class);
    method public String getDataType();
    method public int getIndex(int, int);
    method public int[] getKeys(int);
    method public int getSize(int);
  }

  public class HealthStats {
    ctor public HealthStats(android.os.Parcel);
  }

  public class HealthStatsParceler implements android.os.Parcelable {
    ctor public HealthStatsParceler(android.os.health.HealthStatsWriter);
    ctor public HealthStatsParceler(android.os.Parcel);
    method public int describeContents();
    method public android.os.health.HealthStats getHealthStats();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.health.HealthStatsParceler> CREATOR;
  }

  public class HealthStatsWriter {
    ctor public HealthStatsWriter(android.os.health.HealthKeys.Constants);
    method public void addMeasurement(int, long);
    method public void addMeasurements(int, String, long);
    method public void addStats(int, String, android.os.health.HealthStatsWriter);
    method public void addTimer(int, int, long);
    method public void addTimers(int, String, android.os.health.TimerStat);
    method public void flattenToParcel(android.os.Parcel);
  }

}

package android.os.image {

  public class DynamicSystemClient {
    ctor public DynamicSystemClient(@NonNull android.content.Context);
    method @RequiresPermission("android.permission.INSTALL_DYNAMIC_SYSTEM") public void bind();
    method public void setOnStatusChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.image.DynamicSystemClient.OnStatusChangedListener);
    method public void setOnStatusChangedListener(@NonNull android.os.image.DynamicSystemClient.OnStatusChangedListener);
    method @RequiresPermission("android.permission.INSTALL_DYNAMIC_SYSTEM") public void start(@NonNull android.net.Uri, long);
    method @RequiresPermission("android.permission.INSTALL_DYNAMIC_SYSTEM") public void start(@NonNull android.net.Uri, long, long);
    method @RequiresPermission("android.permission.INSTALL_DYNAMIC_SYSTEM") public void unbind();
    field public static final int CAUSE_ERROR_EXCEPTION = 6; // 0x6
    field public static final int CAUSE_ERROR_INVALID_URL = 4; // 0x4
    field public static final int CAUSE_ERROR_IO = 3; // 0x3
    field public static final int CAUSE_ERROR_IPC = 5; // 0x5
    field public static final int CAUSE_INSTALL_CANCELLED = 2; // 0x2
    field public static final int CAUSE_INSTALL_COMPLETED = 1; // 0x1
    field public static final int CAUSE_NOT_SPECIFIED = 0; // 0x0
    field public static final int STATUS_IN_PROGRESS = 2; // 0x2
    field public static final int STATUS_IN_USE = 4; // 0x4
    field public static final int STATUS_NOT_STARTED = 1; // 0x1
    field public static final int STATUS_READY = 3; // 0x3
    field public static final int STATUS_UNKNOWN = 0; // 0x0
  }

  public static interface DynamicSystemClient.OnStatusChangedListener {
    method public void onStatusChanged(int, int, long, @Nullable Throwable);
  }

}

package android.os.storage {

  public class StorageManager {
    method public static boolean hasIsolatedStorage();
  }

  public final class StorageVolume implements android.os.Parcelable {
    method public String getPath();
  }

}

package android.os.strictmode {

  public final class ExplicitGcViolation extends android.os.strictmode.Violation {
  }

}

package android.permission {

  public final class PermissionControllerManager {
    method @RequiresPermission("android.permission.GET_RUNTIME_PERMISSIONS") public void getAppPermissions(@NonNull String, @NonNull android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, @Nullable android.os.Handler);
    method @RequiresPermission("android.permission.REVOKE_RUNTIME_PERMISSIONS") public void revokeRuntimePermissions(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>>, boolean, int, @NonNull java.util.concurrent.Executor, @NonNull android.permission.PermissionControllerManager.OnRevokeRuntimePermissionsCallback);
    field public static final int COUNT_ONLY_WHEN_GRANTED = 1; // 0x1
    field public static final int COUNT_WHEN_SYSTEM = 2; // 0x2
    field public static final int REASON_INSTALLER_POLICY_VIOLATION = 2; // 0x2
    field public static final int REASON_MALWARE = 1; // 0x1
  }

  public static interface PermissionControllerManager.OnGetAppPermissionResultCallback {
    method public void onGetAppPermissions(@NonNull java.util.List<android.permission.RuntimePermissionPresentationInfo>);
  }

  public abstract static class PermissionControllerManager.OnRevokeRuntimePermissionsCallback {
    ctor public PermissionControllerManager.OnRevokeRuntimePermissionsCallback();
    method public abstract void onRevokeRuntimePermissions(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>>);
  }

  public final class RuntimePermissionPresentationInfo implements android.os.Parcelable {
    ctor public RuntimePermissionPresentationInfo(@NonNull CharSequence, boolean, boolean);
    method public int describeContents();
    method @NonNull public CharSequence getLabel();
    method public boolean isGranted();
    method public boolean isStandard();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.permission.RuntimePermissionPresentationInfo> CREATOR;
  }

}

package android.print {

  public final class PrintJobInfo implements android.os.Parcelable {
    method public float getProgress();
    method @Nullable public CharSequence getStatus(@NonNull android.content.pm.PackageManager);
  }

  public final class PrinterInfo implements android.os.Parcelable {
    method @Nullable public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.Context);
  }

}

package android.provider {

  public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
    field public static final String[] SYNC_WRITABLE_COLUMNS;
  }

  public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
    field public static final String[] SYNC_WRITABLE_COLUMNS;
  }

  public final class ContactsContract {
    field public static final String HIDDEN_COLUMN_PREFIX = "x_";
  }

  public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
    field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
  }

  public static final class ContactsContract.PinnedPositions {
    field public static final String UNDEMOTE_METHOD = "undemote";
  }

  public static final class ContactsContract.RawContactsEntity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns {
    field public static final android.net.Uri CORP_CONTENT_URI;
  }

  public final class DeviceConfig {
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static void addOnPropertiesChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static boolean getBoolean(@NonNull String, @NonNull String, boolean);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static float getFloat(@NonNull String, @NonNull String, float);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static int getInt(@NonNull String, @NonNull String, int);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static long getLong(@NonNull String, @NonNull String, long);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static String getProperty(@NonNull String, @NonNull String);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static String getString(@NonNull String, @NonNull String, @Nullable String);
    method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean);
    field public static final String NAMESPACE_AUTOFILL = "autofill";
    field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
    field public static final String NAMESPACE_PRIVACY = "privacy";
    field public static final String NAMESPACE_ROLLBACK = "rollback";
    field public static final String NAMESPACE_ROLLBACK_BOOT = "rollback_boot";
  }

  public static interface DeviceConfig.OnPropertiesChangedListener {
    method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties);
  }

  public static class DeviceConfig.Properties {
    method public boolean getBoolean(@NonNull String, boolean);
    method public float getFloat(@NonNull String, float);
    method public int getInt(@NonNull String, int);
    method @NonNull public java.util.Set<java.lang.String> getKeyset();
    method public long getLong(@NonNull String, long);
    method @NonNull public String getNamespace();
    method @Nullable public String getString(@NonNull String, @Nullable String);
  }

  public final class MediaStore {
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static void deleteContributedMedia(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static long getContributedMediaSize(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @NonNull public static java.io.File getVolumePath(@NonNull String) throws java.io.FileNotFoundException;
    method @NonNull public static java.util.Collection<java.io.File> getVolumeScanPaths(@NonNull String) throws java.io.FileNotFoundException;
    method public static android.net.Uri scanFile(android.content.Context, java.io.File);
    method public static android.net.Uri scanFileFromShell(android.content.Context, java.io.File);
    method public static void scanVolume(android.content.Context, java.io.File);
  }

  public final class Settings {
    field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
    field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
    field public static final int RESET_MODE_PACKAGE_DEFAULTS = 1; // 0x1
  }

  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
    field public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
    field public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
    field public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
    field public static final String DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD = "dynamic_power_savings_disable_threshold";
    field public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
    field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
    field public static final String LOCATION_GLOBAL_KILL_SWITCH = "location_global_kill_switch";
    field public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
    field public static final String LOW_POWER_MODE = "low_power";
    field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
    field public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
  }

  public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static void resetToDefaults(@NonNull android.content.ContentResolver, @Nullable String);
    field public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = "accessibility_display_magnification_enabled";
    field public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE = "accessibility_shortcut_target_service";
    field public static final String AUTOFILL_FEATURE_FIELD_CLASSIFICATION = "autofill_field_classification";
    field public static final String AUTOFILL_SERVICE = "autofill_service";
    field public static final String AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT = "autofill_user_data_max_category_count";
    field public static final String AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE = "autofill_user_data_max_field_classification_size";
    field public static final String AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE = "autofill_user_data_max_user_data_size";
    field public static final String AUTOFILL_USER_DATA_MAX_VALUE_LENGTH = "autofill_user_data_max_value_length";
    field public static final String AUTOFILL_USER_DATA_MIN_VALUE_LENGTH = "autofill_user_data_min_value_length";
    field public static final String CONTENT_CAPTURE_ENABLED = "content_capture_enabled";
    field public static final String DISABLED_PRINT_SERVICES = "disabled_print_services";
    field public static final String DOZE_ALWAYS_ON = "doze_always_on";
    field @Deprecated public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = "enabled_notification_policy_access_packages";
    field public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
    field public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS = "location_access_check_delay_millis";
    field public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS = "location_access_check_interval_millis";
    field public static final String NOTIFICATION_BADGING = "notification_badging";
    field public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
    field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
    field public static final String USER_SETUP_COMPLETE = "user_setup_complete";
    field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
  }

  public static final class Telephony.Sms.Intents {
    field public static final String SMS_CARRIER_PROVISION_ACTION = "android.provider.Telephony.SMS_CARRIER_PROVISION";
  }

  public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns {
    field public static final String _DATA = "_data";
  }

}

package android.security {

  public class KeyStoreException extends java.lang.Exception {
    ctor public KeyStoreException(int, String);
    method public int getErrorCode();
  }

}

package android.security.keystore {

  public abstract class AttestationUtils {
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public static java.security.cert.X509Certificate[] attestDeviceIds(android.content.Context, @NonNull int[], @NonNull byte[]) throws android.security.keystore.DeviceIdAttestationException;
    field public static final int ID_TYPE_IMEI = 2; // 0x2
    field public static final int ID_TYPE_MEID = 3; // 0x3
    field public static final int ID_TYPE_SERIAL = 1; // 0x1
  }

  public class DeviceIdAttestationException extends java.lang.Exception {
    ctor public DeviceIdAttestationException(@Nullable String);
    ctor public DeviceIdAttestationException(@Nullable String, @Nullable Throwable);
  }

  public static final class KeyGenParameterSpec.Builder {
    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUniqueIdIncluded(boolean);
  }

  public final class KeyProtection implements java.security.KeyStore.ProtectionParameter {
    method public long getBoundToSpecificSecureUserId();
  }

  public static final class KeyProtection.Builder {
    method public android.security.keystore.KeyProtection.Builder setBoundToSpecificSecureUserId(long);
  }

}

package android.service.appprediction {

  public abstract class AppPredictionService extends android.app.Service {
    ctor public AppPredictionService();
    method @MainThread public abstract void onAppTargetEvent(@NonNull android.app.prediction.AppPredictionSessionId, @NonNull android.app.prediction.AppTargetEvent);
    method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method public void onCreatePredictionSession(@NonNull android.app.prediction.AppPredictionContext, @NonNull android.app.prediction.AppPredictionSessionId);
    method @MainThread public void onDestroyPredictionSession(@NonNull android.app.prediction.AppPredictionSessionId);
    method @MainThread public abstract void onLaunchLocationShown(@NonNull android.app.prediction.AppPredictionSessionId, @NonNull String, @NonNull java.util.List<android.app.prediction.AppTargetId>);
    method @MainThread public abstract void onRequestPredictionUpdate(@NonNull android.app.prediction.AppPredictionSessionId);
    method @MainThread public abstract void onSortAppTargets(@NonNull android.app.prediction.AppPredictionSessionId, @NonNull java.util.List<android.app.prediction.AppTarget>, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<java.util.List<android.app.prediction.AppTarget>>);
    method @MainThread public void onStartPredictionUpdates();
    method @MainThread public void onStopPredictionUpdates();
    method public final void updatePredictions(@NonNull android.app.prediction.AppPredictionSessionId, @NonNull java.util.List<android.app.prediction.AppTarget>);
  }

}

package android.service.autofill {

  public abstract class AutofillFieldClassificationService extends android.app.Service {
    method public android.os.IBinder onBind(android.content.Intent);
    field public static final String REQUIRED_ALGORITHM_EDIT_DISTANCE = "EDIT_DISTANCE";
    field public static final String REQUIRED_ALGORITHM_EXACT_MATCH = "EXACT_MATCH";
    field public static final String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService";
    field public static final String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms";
    field public static final String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm";
  }

  public final class CharSequenceTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
  }

  public final class CompositeUserData implements android.os.Parcelable {
    ctor public CompositeUserData(@Nullable android.service.autofill.UserData, @NonNull android.service.autofill.UserData);
    method public int describeContents();
    method public String[] getCategoryIds();
    method public android.os.Bundle getDefaultFieldClassificationArgs();
    method @Nullable public String getFieldClassificationAlgorithm();
    method @Nullable public String getFieldClassificationAlgorithmForCategory(@NonNull String);
    method public android.util.ArrayMap<java.lang.String,java.lang.String> getFieldClassificationAlgorithms();
    method public android.util.ArrayMap<java.lang.String,android.os.Bundle> getFieldClassificationArgs();
    method public String[] getValues();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CompositeUserData> CREATOR;
  }

  public final class CustomDescription implements android.os.Parcelable {
    method @Nullable public android.util.SparseArray<android.service.autofill.InternalOnClickAction> getActions();
  }

  public final class DateTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
  }

  public final class DateValueSanitizer extends android.service.autofill.InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    method @Nullable public android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
  }

  public final class FillResponse implements android.os.Parcelable {
    method public int getFlags();
  }

  public final class ImageTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
  }

  public abstract class InternalOnClickAction implements android.service.autofill.OnClickAction android.os.Parcelable {
    ctor public InternalOnClickAction();
    method public abstract void onClick(@NonNull android.view.ViewGroup);
  }

  public abstract class InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public InternalSanitizer();
    method @Nullable public abstract android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
  }

  public abstract class InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    ctor public InternalTransformation();
    method public static boolean batchApply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, @NonNull java.util.ArrayList<android.util.Pair<java.lang.Integer,android.service.autofill.InternalTransformation>>);
  }

  public abstract class InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
    ctor public InternalValidator();
    method public abstract boolean isValid(@NonNull android.service.autofill.ValueFinder);
  }

  public final class LuhnChecksumValidator extends android.service.autofill.InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
    method public boolean isValid(@NonNull android.service.autofill.ValueFinder);
  }

  public final class RegexValidator extends android.service.autofill.InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
    method public boolean isValid(@NonNull android.service.autofill.ValueFinder);
  }

  public final class TextValueSanitizer extends android.service.autofill.InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    method @Nullable public android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
  }

  public final class UserData implements android.os.Parcelable {
    method public android.util.ArrayMap<java.lang.String,java.lang.String> getFieldClassificationAlgorithms();
  }

  public interface ValueFinder {
    method @Nullable public default String findByAutofillId(@NonNull android.view.autofill.AutofillId);
    method @Nullable public android.view.autofill.AutofillValue findRawValueByAutofillId(@NonNull android.view.autofill.AutofillId);
  }

  public final class VisibilitySetterAction extends android.service.autofill.InternalOnClickAction implements android.service.autofill.OnClickAction android.os.Parcelable {
    method public void onClick(@NonNull android.view.ViewGroup);
  }

}

package android.service.autofill.augmented {

  public abstract class AugmentedAutofillService extends android.app.Service {
    ctor public AugmentedAutofillService();
    method protected final void dump(java.io.FileDescriptor, java.io.PrintWriter, String[]);
    method protected void dump(@NonNull java.io.PrintWriter, @NonNull String[]);
    method public void onConnected();
    method public void onDisconnected();
    method public void onFillRequest(@NonNull android.service.autofill.augmented.FillRequest, @NonNull android.os.CancellationSignal, @NonNull android.service.autofill.augmented.FillController, @NonNull android.service.autofill.augmented.FillCallback);
    field public static final String SERVICE_INTERFACE = "android.service.autofill.augmented.AugmentedAutofillService";
  }

  public final class FillCallback {
    method public void onSuccess(@Nullable android.service.autofill.augmented.FillResponse);
  }

  public final class FillController {
    method public void autofill(@NonNull java.util.List<android.util.Pair<android.view.autofill.AutofillId,android.view.autofill.AutofillValue>>);
  }

  public final class FillRequest {
    method @NonNull public android.content.ComponentName getActivityComponent();
    method @NonNull public android.view.autofill.AutofillId getFocusedId();
    method @NonNull public android.view.autofill.AutofillValue getFocusedValue();
    method @Nullable public android.service.autofill.augmented.PresentationParams getPresentationParams();
    method public int getTaskId();
  }

  public final class FillResponse {
  }

  public static final class FillResponse.Builder {
    ctor public FillResponse.Builder();
    method @NonNull public android.service.autofill.augmented.FillResponse build();
    method @NonNull public android.service.autofill.augmented.FillResponse.Builder setFillWindow(@NonNull android.service.autofill.augmented.FillWindow);
  }

  public final class FillWindow implements java.lang.AutoCloseable {
    ctor public FillWindow();
    method public void destroy();
    method public boolean update(@NonNull android.service.autofill.augmented.PresentationParams.Area, @NonNull android.view.View, long);
  }

  public abstract class PresentationParams {
    method @Nullable public android.service.autofill.augmented.PresentationParams.Area getSuggestionArea();
  }

  public abstract static class PresentationParams.Area {
    method @NonNull public android.graphics.Rect getBounds();
  }

}

package android.service.contentcapture {

  public final class ActivityEvent implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.content.ComponentName getComponentName();
    method public int getEventType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
    field public static final int TYPE_ACTIVITY_DESTROYED = 24; // 0x18
    field public static final int TYPE_ACTIVITY_PAUSED = 2; // 0x2
    field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1
    field public static final int TYPE_ACTIVITY_STOPPED = 23; // 0x17
  }

  public abstract class ContentCaptureService extends android.app.Service {
    ctor public ContentCaptureService();
    method public final void disableSelf();
    method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent);
    method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData);
    method public void onConnected();
    method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent);
    method public void onCreateContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureContext, @NonNull android.view.contentcapture.ContentCaptureSessionId);
    method public void onDataRemovalRequest(@NonNull android.view.contentcapture.DataRemovalRequest);
    method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId);
    method public void onDisconnected();
    method public final void setContentCaptureConditions(@NonNull String, @Nullable java.util.Set<android.view.contentcapture.ContentCaptureCondition>);
    method public final void setContentCaptureWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
    field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService";
    field public static final String SERVICE_META_DATA = "android.content_capture";
  }

  public final class SnapshotData implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.app.assist.AssistContent getAssistContent();
    method @NonNull public android.os.Bundle getAssistData();
    method @NonNull public android.app.assist.AssistStructure getAssistStructure();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.SnapshotData> CREATOR;
  }

}

package android.service.notification {

  public final class Adjustment implements android.os.Parcelable {
    ctor public Adjustment(String, String, android.os.Bundle, CharSequence, int);
    ctor public Adjustment(@NonNull String, @NonNull String, @NonNull android.os.Bundle, @NonNull CharSequence, @NonNull android.os.UserHandle);
    method public int describeContents();
    method @NonNull public CharSequence getExplanation();
    method @NonNull public String getKey();
    method @NonNull public String getPackage();
    method @NonNull public android.os.Bundle getSignals();
    method public int getUser();
    method @NonNull public android.os.UserHandle getUserHandle();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
    field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
    field public static final String KEY_IMPORTANCE = "key_importance";
    field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
    field public static final String KEY_TEXT_REPLIES = "key_text_replies";
    field public static final String KEY_USER_SENTIMENT = "key_user_sentiment";
  }

  @Deprecated public abstract class ConditionProviderService extends android.app.Service {
    method @Deprecated public boolean isBound();
  }

  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
    ctor public NotificationAssistantService();
    method public final void adjustNotification(@NonNull android.service.notification.Adjustment);
    method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>);
    method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
    method public void onAllowedAdjustmentsChanged();
    method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
    method public void onNotificationDirectReplied(@NonNull String);
    method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification);
    method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel);
    method public void onNotificationExpansionChanged(@NonNull String, boolean, boolean);
    method public abstract void onNotificationSnoozedUntilContext(@NonNull android.service.notification.StatusBarNotification, @NonNull String);
    method public void onNotificationsSeen(@NonNull java.util.List<java.lang.String>);
    method public void onSuggestedReplySent(@NonNull String, @NonNull CharSequence, int);
    method public final void unsnoozeNotification(@NonNull String);
    field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
    field public static final int SOURCE_FROM_APP = 0; // 0x0
    field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1
  }

  public abstract class NotificationListenerService extends android.app.Service {
    method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int);
  }

  public final class NotificationStats implements android.os.Parcelable {
    ctor public NotificationStats();
    method public int describeContents();
    method public int getDismissalSentiment();
    method public int getDismissalSurface();
    method public boolean hasDirectReplied();
    method public boolean hasExpanded();
    method public boolean hasInteracted();
    method public boolean hasSeen();
    method public boolean hasSnoozed();
    method public boolean hasViewedSettings();
    method public void setDirectReplied();
    method public void setDismissalSentiment(int);
    method public void setDismissalSurface(int);
    method public void setExpanded();
    method public void setSeen();
    method public void setSnoozed();
    method public void setViewedSettings();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.NotificationStats> CREATOR;
    field public static final int DISMISSAL_AOD = 2; // 0x2
    field public static final int DISMISSAL_NOT_DISMISSED = -1; // 0xffffffff
    field public static final int DISMISSAL_OTHER = 0; // 0x0
    field public static final int DISMISSAL_PEEK = 1; // 0x1
    field public static final int DISMISSAL_SHADE = 3; // 0x3
    field public static final int DISMISS_SENTIMENT_NEGATIVE = 0; // 0x0
    field public static final int DISMISS_SENTIMENT_NEUTRAL = 1; // 0x1
    field public static final int DISMISS_SENTIMENT_POSITIVE = 2; // 0x2
    field public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; // 0xfffffc18
  }

  public final class SnoozeCriterion implements android.os.Parcelable {
    ctor public SnoozeCriterion(String, CharSequence, CharSequence);
    ctor protected SnoozeCriterion(android.os.Parcel);
    method public int describeContents();
    method public CharSequence getConfirmation();
    method public CharSequence getExplanation();
    method public String getId();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.SnoozeCriterion> CREATOR;
  }

}

package android.service.quicksettings {

  public class TileService extends android.app.Service {
    method public static boolean isQuickSettingsSupported();
  }

}

package android.telecom {

  public final class CallAudioState implements android.os.Parcelable {
    ctor public CallAudioState(boolean, int, int, @Nullable android.bluetooth.BluetoothDevice, @NonNull java.util.Collection<android.bluetooth.BluetoothDevice>);
  }

  public abstract class Conference extends android.telecom.Conferenceable {
    method public android.telecom.Connection getPrimaryConnection();
  }

  public class PhoneAccountSuggestionService extends android.app.Service {
    ctor public PhoneAccountSuggestionService();
    method public void onAccountSuggestionRequest(@NonNull String);
    method public android.os.IBinder onBind(android.content.Intent);
    method public final void suggestPhoneAccounts(@NonNull String, @NonNull java.util.List<android.telecom.PhoneAccountSuggestion>);
    field public static final String SERVICE_INTERFACE = "android.telecom.PhoneAccountSuggestionService";
  }

  public class TelecomManager {
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
    field public static final int TTY_MODE_FULL = 1; // 0x1
    field public static final int TTY_MODE_HCO = 2; // 0x2
    field public static final int TTY_MODE_OFF = 0; // 0x0
    field public static final int TTY_MODE_VCO = 3; // 0x3
  }

}

package android.telephony {

  public final class AccessNetworkConstants {
    field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
    field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
  }

  public class CarrierConfigManager {
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void overrideConfig(int, @Nullable android.os.PersistableBundle);
  }

  public final class DataSpecificRegistrationInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
  }

  public final class LteVopsSupportInfo implements android.os.Parcelable {
    ctor public LteVopsSupportInfo(int, int);
    method public int describeContents();
    method public int getEmcBearerSupport();
    method public int getVopsSupport();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.LteVopsSupportInfo> CREATOR;
    field public static final int LTE_STATUS_NOT_AVAILABLE = 1; // 0x1
    field public static final int LTE_STATUS_NOT_SUPPORTED = 3; // 0x3
    field public static final int LTE_STATUS_SUPPORTED = 2; // 0x2
  }

  public class MbmsDownloadSession implements java.lang.AutoCloseable {
    field public static final String MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA = "mbms-download-service-override";
  }

  public class MbmsGroupCallSession implements java.lang.AutoCloseable {
    field public static final String MBMS_GROUP_CALL_SERVICE_OVERRIDE_METADATA = "mbms-group-call-service-override";
  }

  public class MbmsStreamingSession implements java.lang.AutoCloseable {
    field public static final String MBMS_STREAMING_SERVICE_OVERRIDE_METADATA = "mbms-streaming-service-override";
  }

  public final class NetworkRegistrationInfo implements android.os.Parcelable {
    method public int describeContents();
    method public int getAccessNetworkTechnology();
    method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
    method @Nullable public android.telephony.CellIdentity getCellIdentity();
    method @Nullable public android.telephony.DataSpecificRegistrationInfo getDataSpecificInfo();
    method public int getDomain();
    method public int getRegistrationState();
    method public int getRejectCause();
    method public int getRoamingType();
    method public int getTransportType();
    method public boolean isEmergencyEnabled();
    method public boolean isRoaming();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR;
    field public static final int DOMAIN_CS = 1; // 0x1
    field public static final int DOMAIN_PS = 2; // 0x2
    field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3
    field public static final int REGISTRATION_STATE_HOME = 1; // 0x1
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2
    field public static final int REGISTRATION_STATE_ROAMING = 5; // 0x5
    field public static final int REGISTRATION_STATE_UNKNOWN = 4; // 0x4
    field public static final int SERVICE_TYPE_DATA = 2; // 0x2
    field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
    field public static final int SERVICE_TYPE_SMS = 3; // 0x3
    field public static final int SERVICE_TYPE_UNKNOWN = 0; // 0x0
    field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
    field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
  }

  public static final class NetworkRegistrationInfo.Builder {
    ctor public NetworkRegistrationInfo.Builder();
    method @NonNull public android.telephony.NetworkRegistrationInfo build();
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAccessNetworkTechnology(int);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAvailableServices(@NonNull java.util.List<java.lang.Integer>);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setDomain(int);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegistrationState(int);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int);
    method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int);
  }

  public class ServiceState implements android.os.Parcelable {
    method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo);
    method public void setCdmaSystemAndNetworkId(int, int);
    method public void setCellBandwidths(int[]);
    method public void setChannelNumber(int);
    method public void setDataRoamingType(int);
    method public void setRilDataRadioTechnology(int);
    method public void setRilVoiceRadioTechnology(int);
    method public void setVoiceRoamingType(int);
  }

  public final class SmsManager {
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int checkSmsShortCodeDestination(String, String);
    field public static final int SMS_CATEGORY_FREE_SHORT_CODE = 1; // 0x1
    field public static final int SMS_CATEGORY_NOT_SHORT_CODE = 0; // 0x0
    field public static final int SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3; // 0x3
    field public static final int SMS_CATEGORY_PREMIUM_SHORT_CODE = 4; // 0x4
    field public static final int SMS_CATEGORY_STANDARD_SHORT_CODE = 2; // 0x2
  }

  public class TelephonyManager {
    method public int checkCarrierPrivilegesForPackage(String);
    method public int getCarrierIdListVersion();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
    method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
    method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
    method public void setCarrierTestOverride(String, String, String, String, String, String, String, String, String);
    field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe
    field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1
    field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0
    field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff
    field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
  }

}

package android.telephony.mbms {

  public static class DownloadRequest.Builder {
    method public android.telephony.mbms.DownloadRequest.Builder setServiceId(String);
  }

  public final class FileInfo implements android.os.Parcelable {
    ctor public FileInfo(android.net.Uri, String);
  }

  public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
    ctor public FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>);
  }

  public final class StreamingServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
    ctor public StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date);
  }

  public final class UriPathPair implements android.os.Parcelable {
    method public int describeContents();
    method public android.net.Uri getContentUri();
    method public android.net.Uri getFilePathUri();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
  }

}

package android.telephony.mbms.vendor {

  public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
    ctor public MbmsDownloadServiceBase();
    method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
    method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
    method public android.os.IBinder asBinder();
    method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
    method public void dispose(int) throws android.os.RemoteException;
    method public int download(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
    method public int initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback) throws android.os.RemoteException;
    method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads(int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
    method public int removeProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
    method public int removeStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
    method public int requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
    method public int requestUpdateFileServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
    method public int resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
    method public int setTempFileRootDirectory(int, String) throws android.os.RemoteException;
  }

  public class MbmsGroupCallServiceBase extends android.app.Service {
    ctor public MbmsGroupCallServiceBase();
    method public void dispose(int) throws android.os.RemoteException;
    method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    method public android.os.IBinder onBind(android.content.Intent);
    method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback);
    method public void stopGroupCall(int, long);
    method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
  }

  public class MbmsStreamingServiceBase extends android.os.Binder implements android.os.IInterface {
    ctor public MbmsStreamingServiceBase();
    method public android.os.IBinder asBinder();
    method public void dispose(int) throws android.os.RemoteException;
    method @Nullable public android.net.Uri getPlaybackUri(int, String) throws android.os.RemoteException;
    method public int initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
    method public int requestUpdateStreamingServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
    method public int startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback) throws android.os.RemoteException;
    method public void stopStreaming(int, String) throws android.os.RemoteException;
  }

  public class VendorUtils {
    ctor public VendorUtils();
    method public static android.content.ComponentName getAppReceiverFromPackageName(android.content.Context, String);
    field public static final String ACTION_CLEANUP = "android.telephony.mbms.action.CLEANUP";
    field public static final String ACTION_DOWNLOAD_RESULT_INTERNAL = "android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL";
    field public static final String ACTION_FILE_DESCRIPTOR_REQUEST = "android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST";
    field public static final String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT";
    field public static final String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI";
    field public static final String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST";
    field public static final String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST";
    field public static final String EXTRA_PAUSED_URI_LIST = "android.telephony.mbms.extra.PAUSED_URI_LIST";
    field public static final String EXTRA_SERVICE_ID = "android.telephony.mbms.extra.SERVICE_ID";
    field public static final String EXTRA_TEMP_FILES_IN_USE = "android.telephony.mbms.extra.TEMP_FILES_IN_USE";
    field public static final String EXTRA_TEMP_FILE_ROOT = "android.telephony.mbms.extra.TEMP_FILE_ROOT";
    field public static final String EXTRA_TEMP_LIST = "android.telephony.mbms.extra.TEMP_LIST";
  }

}

package android.text {

  public static final class Selection.MemoryTextWatcher implements android.text.TextWatcher {
    ctor public Selection.MemoryTextWatcher();
    method public void afterTextChanged(android.text.Editable);
    method public void beforeTextChanged(CharSequence, int, int, int);
    method public void onTextChanged(CharSequence, int, int, int);
  }

}

package android.transition {

  public class TransitionManager {
    method public android.transition.Transition getTransition(android.transition.Scene);
  }

}

package android.util {

  public final class ArraySet<E> implements java.util.Collection<E> java.util.Set<E> {
    method public E valueAtUnchecked(int);
  }

  public class FeatureFlagUtils {
    ctor public FeatureFlagUtils();
    method public static java.util.Map<java.lang.String,java.lang.String> getAllFeatureFlags();
    method public static boolean isEnabled(android.content.Context, String);
    method public static void setEnabled(android.content.Context, String, boolean);
    field public static final String DYNAMIC_SYSTEM = "settings_dynamic_system";
    field public static final String FFLAG_OVERRIDE_PREFIX = "sys.fflag.override.";
    field public static final String FFLAG_PREFIX = "sys.fflag.";
    field public static final String HEARING_AID_SETTINGS = "settings_bluetooth_hearing_aid";
    field public static final String PERSIST_PREFIX = "persist.sys.fflag.override.";
    field public static final String PIXEL_WALLPAPER_CATEGORY_SWITCH = "settings_pixel_wallpaper_category_switch";
    field public static final String SCREENRECORD_LONG_PRESS = "settings_screenrecord_long_press";
    field public static final String SEAMLESS_TRANSFER = "settings_seamless_transfer";
  }

  public class TimeUtils {
    method public static String formatDuration(long);
  }

}

package android.util.proto {

  public final class EncodedBuffer {
    ctor public EncodedBuffer();
    ctor public EncodedBuffer(int);
    method public void dumpBuffers(String);
    method public static void dumpByteString(String, String, byte[]);
    method public void editRawFixed32(int, int);
    method public byte[] getBytes(int);
    method public int getChunkCount();
    method public String getDebugString();
    method public int getRawFixed32At(int);
    method public static int getRawVarint32Size(int);
    method public static int getRawVarint64Size(long);
    method public static int getRawZigZag32Size(int);
    method public static int getRawZigZag64Size(long);
    method public int getReadPos();
    method public int getReadableSize();
    method public int getSize();
    method public int getWriteBufIndex();
    method public int getWriteIndex();
    method public int getWritePos();
    method public byte readRawByte();
    method public int readRawFixed32();
    method public long readRawUnsigned();
    method public void rewindRead();
    method public void rewindWriteTo(int);
    method public void skipRead(int);
    method public void startEditing();
    method public void writeFromThisBuffer(int, int);
    method public void writeRawBuffer(byte[]);
    method public void writeRawBuffer(byte[], int, int);
    method public void writeRawByte(byte);
    method public void writeRawFixed32(int);
    method public void writeRawFixed64(long);
    method public void writeRawVarint32(int);
    method public void writeRawVarint64(long);
    method public void writeRawZigZag32(int);
    method public void writeRawZigZag64(long);
  }

  public final class ProtoOutputStream extends android.util.proto.ProtoStream {
    ctor public ProtoOutputStream();
    ctor public ProtoOutputStream(int);
    ctor public ProtoOutputStream(java.io.OutputStream);
    ctor public ProtoOutputStream(java.io.FileDescriptor);
    method public static int checkFieldId(long, long);
    method public void dump(String);
    method public void end(long);
    method @Deprecated public void endObject(long);
    method @Deprecated public void endRepeatedObject(long);
    method public void flush();
    method public byte[] getBytes();
    method public int getRawSize();
    method public static long makeFieldId(int, long);
    method public long start(long);
    method @Deprecated public long startObject(long);
    method @Deprecated public long startRepeatedObject(long);
    method public void write(long, double);
    method public void write(long, float);
    method public void write(long, int);
    method public void write(long, long);
    method public void write(long, boolean);
    method public void write(long, String);
    method public void write(long, byte[]);
    method @Deprecated public void writeBool(long, boolean);
    method @Deprecated public void writeBytes(long, byte[]);
    method @Deprecated public void writeDouble(long, double);
    method @Deprecated public void writeEnum(long, int);
    method @Deprecated public void writeFixed32(long, int);
    method @Deprecated public void writeFixed64(long, long);
    method @Deprecated public void writeFloat(long, float);
    method @Deprecated public void writeInt32(long, int);
    method @Deprecated public void writeInt64(long, long);
    method @Deprecated public void writeObject(long, byte[]);
    method @Deprecated public void writePackedBool(long, boolean[]);
    method @Deprecated public void writePackedDouble(long, double[]);
    method @Deprecated public void writePackedEnum(long, int[]);
    method @Deprecated public void writePackedFixed32(long, int[]);
    method @Deprecated public void writePackedFixed64(long, long[]);
    method @Deprecated public void writePackedFloat(long, float[]);
    method @Deprecated public void writePackedInt32(long, int[]);
    method @Deprecated public void writePackedInt64(long, long[]);
    method @Deprecated public void writePackedSFixed32(long, int[]);
    method @Deprecated public void writePackedSFixed64(long, long[]);
    method @Deprecated public void writePackedSInt32(long, int[]);
    method @Deprecated public void writePackedSInt64(long, long[]);
    method @Deprecated public void writePackedUInt32(long, int[]);
    method @Deprecated public void writePackedUInt64(long, long[]);
    method @Deprecated public void writeRepeatedBool(long, boolean);
    method @Deprecated public void writeRepeatedBytes(long, byte[]);
    method @Deprecated public void writeRepeatedDouble(long, double);
    method @Deprecated public void writeRepeatedEnum(long, int);
    method @Deprecated public void writeRepeatedFixed32(long, int);
    method @Deprecated public void writeRepeatedFixed64(long, long);
    method @Deprecated public void writeRepeatedFloat(long, float);
    method @Deprecated public void writeRepeatedInt32(long, int);
    method @Deprecated public void writeRepeatedInt64(long, long);
    method @Deprecated public void writeRepeatedObject(long, byte[]);
    method @Deprecated public void writeRepeatedSFixed32(long, int);
    method @Deprecated public void writeRepeatedSFixed64(long, long);
    method @Deprecated public void writeRepeatedSInt32(long, int);
    method @Deprecated public void writeRepeatedSInt64(long, long);
    method @Deprecated public void writeRepeatedString(long, String);
    method @Deprecated public void writeRepeatedUInt32(long, int);
    method @Deprecated public void writeRepeatedUInt64(long, long);
    method @Deprecated public void writeSFixed32(long, int);
    method @Deprecated public void writeSFixed64(long, long);
    method @Deprecated public void writeSInt32(long, int);
    method @Deprecated public void writeSInt64(long, long);
    method @Deprecated public void writeString(long, String);
    method public void writeTag(int, int);
    method @Deprecated public void writeUInt32(long, int);
    method @Deprecated public void writeUInt64(long, long);
  }

  public class ProtoParseException extends java.lang.RuntimeException {
    ctor public ProtoParseException(String);
  }

  public abstract class ProtoStream {
    ctor public ProtoStream();
    method public static int convertObjectIdToOrdinal(int);
    method public static int getDepthFromToken(long);
    method public static String getFieldCountString(long);
    method public static String getFieldIdString(long);
    method public static String getFieldTypeString(long);
    method public static int getObjectIdFromToken(long);
    method public static int getOffsetFromToken(long);
    method public static boolean getRepeatedFromToken(long);
    method public static int getTagSizeFromToken(long);
    method public static String getWireTypeString(int);
    method public static long makeFieldId(int, long);
    method public static long makeToken(int, boolean, int, int, int);
    method public static String token2String(long);
    field public static final long FIELD_COUNT_MASK = 16492674416640L; // 0xf0000000000L
    field public static final long FIELD_COUNT_PACKED = 5497558138880L; // 0x50000000000L
    field public static final long FIELD_COUNT_REPEATED = 2199023255552L; // 0x20000000000L
    field public static final int FIELD_COUNT_SHIFT = 40; // 0x28
    field public static final long FIELD_COUNT_SINGLE = 1099511627776L; // 0x10000000000L
    field public static final long FIELD_COUNT_UNKNOWN = 0L; // 0x0L
    field public static final int FIELD_ID_MASK = -8; // 0xfffffff8
    field public static final int FIELD_ID_SHIFT = 3; // 0x3
    field public static final long FIELD_TYPE_BOOL = 34359738368L; // 0x800000000L
    field public static final long FIELD_TYPE_BYTES = 51539607552L; // 0xc00000000L
    field public static final long FIELD_TYPE_DOUBLE = 4294967296L; // 0x100000000L
    field public static final long FIELD_TYPE_ENUM = 60129542144L; // 0xe00000000L
    field public static final long FIELD_TYPE_FIXED32 = 30064771072L; // 0x700000000L
    field public static final long FIELD_TYPE_FIXED64 = 25769803776L; // 0x600000000L
    field public static final long FIELD_TYPE_FLOAT = 8589934592L; // 0x200000000L
    field public static final long FIELD_TYPE_INT32 = 21474836480L; // 0x500000000L
    field public static final long FIELD_TYPE_INT64 = 12884901888L; // 0x300000000L
    field public static final long FIELD_TYPE_MASK = 1095216660480L; // 0xff00000000L
    field public static final long FIELD_TYPE_MESSAGE = 47244640256L; // 0xb00000000L
    field protected static final String[] FIELD_TYPE_NAMES;
    field public static final long FIELD_TYPE_SFIXED32 = 64424509440L; // 0xf00000000L
    field public static final long FIELD_TYPE_SFIXED64 = 68719476736L; // 0x1000000000L
    field public static final int FIELD_TYPE_SHIFT = 32; // 0x20
    field public static final long FIELD_TYPE_SINT32 = 73014444032L; // 0x1100000000L
    field public static final long FIELD_TYPE_SINT64 = 77309411328L; // 0x1200000000L
    field public static final long FIELD_TYPE_STRING = 38654705664L; // 0x900000000L
    field public static final long FIELD_TYPE_UINT32 = 55834574848L; // 0xd00000000L
    field public static final long FIELD_TYPE_UINT64 = 17179869184L; // 0x400000000L
    field public static final long FIELD_TYPE_UNKNOWN = 0L; // 0x0L
    field public static final int WIRE_TYPE_END_GROUP = 4; // 0x4
    field public static final int WIRE_TYPE_FIXED32 = 5; // 0x5
    field public static final int WIRE_TYPE_FIXED64 = 1; // 0x1
    field public static final int WIRE_TYPE_LENGTH_DELIMITED = 2; // 0x2
    field public static final int WIRE_TYPE_MASK = 7; // 0x7
    field public static final int WIRE_TYPE_START_GROUP = 3; // 0x3
    field public static final int WIRE_TYPE_VARINT = 0; // 0x0
  }

  public class WireTypeMismatchException extends android.util.proto.ProtoParseException {
    ctor public WireTypeMismatchException(String);
  }

}

package android.view {

  public abstract class ActionMode {
    method public boolean isUiFocusable();
  }

  public final class Choreographer {
    method public static long getFrameDelay();
    method public void postCallback(int, Runnable, Object);
    method public void postCallbackDelayed(int, Runnable, Object, long);
    method public void removeCallbacks(int, Runnable, Object);
    method public static void setFrameDelay(long);
    field public static final int CALLBACK_ANIMATION = 1; // 0x1
  }

  public final class Display {
    method public boolean hasAccess(int);
  }

  public class FocusFinder {
    method public static void sort(android.view.View[], int, int, android.view.ViewGroup, boolean);
  }

  public final class InputDevice implements android.os.Parcelable {
    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void disable();
    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void enable();
  }

  public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public static String actionToString(int);
    method public final void setDisplayId(int);
    field public static final int LAST_KEYCODE = 288; // 0x120
  }

  public final class KeyboardShortcutGroup implements android.os.Parcelable {
    ctor public KeyboardShortcutGroup(@Nullable CharSequence, @NonNull java.util.List<android.view.KeyboardShortcutInfo>, boolean);
    ctor public KeyboardShortcutGroup(@Nullable CharSequence, boolean);
    method public boolean isSystemGroup();
  }

  public abstract class LayoutInflater {
    method public void setPrecompiledLayoutsEnabledForTesting(boolean);
  }

  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public void setActionButton(int);
    method public void setButtonState(int);
    method public void setDisplayId(int);
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface RemotableViewMethod {
    method public abstract String asyncImpl() default "";
  }

  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
    method public android.view.View getTooltipView();
    method public boolean isAutofilled();
    method public static boolean isDefaultFocusHighlightEnabled();
    method public boolean isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
    method protected void resetResolvedDrawables();
    method public void resetResolvedLayoutDirection();
    method public void resetResolvedPadding();
    method public void resetResolvedTextAlignment();
    method public void resetResolvedTextDirection();
    method public void resetRtlProperties();
    method public boolean restoreFocusInCluster(int);
    method public boolean restoreFocusNotInCluster();
    method public void setAutofilled(boolean);
    method public final void setFocusedInCluster();
    method public void setIsRootNamespace(boolean);
  }

  public class ViewConfiguration {
    method public long getDeviceGlobalActionKeyTimeout();
    method public static int getHoverTooltipHideShortTimeout();
    method public static int getHoverTooltipHideTimeout();
    method public static int getHoverTooltipShowTimeout();
    method public static int getLongPressTooltipHideTimeout();
  }

  public class ViewDebug {
    method @Deprecated @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>);
    method @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>);
  }

  public interface WindowManager extends android.view.ViewManager {
    method public default void setShouldShowIme(int, boolean);
    method public default void setShouldShowSystemDecors(int, boolean);
    method public default void setShouldShowWithInsecureKeyguard(int, boolean);
    method public default boolean shouldShowIme(int);
    method public default boolean shouldShowSystemDecors(int);
  }

  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
    field public static final int ACCESSIBILITY_TITLE_CHANGED = 33554432; // 0x2000000
    field public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 64; // 0x40
    field public CharSequence accessibilityTitle;
    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=0x1, equals=0x1, name="FAKE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x2, equals=0x2, name="FORCE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x4, equals=0x4, name="WANTS_OFFSET_NOTIFICATIONS"), @android.view.ViewDebug.FlagToString(mask=0x10, equals=0x10, name="SHOW_FOR_ALL_USERS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, equals=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, name="NO_MOVE_ANIMATION"), @android.view.ViewDebug.FlagToString(mask=0x80, equals=0x80, name="COMPATIBLE_WINDOW"), @android.view.ViewDebug.FlagToString(mask=0x100, equals=0x100, name="SYSTEM_ERROR"), @android.view.ViewDebug.FlagToString(mask=0x200, equals=0x200, name="INHERIT_TRANSLUCENT_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x400, equals=0x400, name="KEYGUARD"), @android.view.ViewDebug.FlagToString(mask=0x800, equals=0x800, name="DISABLE_WALLPAPER_TOUCH_EVENTS"), @android.view.ViewDebug.FlagToString(mask=0x1000, equals=0x1000, name="FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"), @android.view.ViewDebug.FlagToString(mask=0x2000, equals=0x2000, name="PRESERVE_GEOMETRY"), @android.view.ViewDebug.FlagToString(mask=0x4000, equals=0x4000, name="FORCE_DECOR_VIEW_VISIBILITY"), @android.view.ViewDebug.FlagToString(mask=0x8000, equals=0x8000, name="WILL_NOT_REPLACE_ON_RELAUNCH"), @android.view.ViewDebug.FlagToString(mask=0x10000, equals=0x10000, name="LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"), @android.view.ViewDebug.FlagToString(mask=0x20000, equals=0x20000, name="FORCE_DRAW_STATUS_BAR_BACKGROUND"), @android.view.ViewDebug.FlagToString(mask=0x40000, equals=0x40000, name="SUSTAINED_PERFORMANCE_MODE"), @android.view.ViewDebug.FlagToString(mask=0x80000, equals=0x80000, name="HIDE_NON_SYSTEM_OVERLAY_WINDOWS"), @android.view.ViewDebug.FlagToString(mask=0x100000, equals=0x100000, name="IS_ROUNDED_CORNERS_OVERLAY"), @android.view.ViewDebug.FlagToString(mask=0x400000, equals=0x400000, name="IS_SCREEN_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x800000, equals=0x800000, name="STATUS_FORCE_SHOW_NAVIGATION"), @android.view.ViewDebug.FlagToString(mask=0x1000000, equals=0x1000000, name="COLOR_SPACE_AGNOSTIC")}) public int privateFlags;
  }

}

package android.view.accessibility {

  public final class AccessibilityManager {
    method public void addAccessibilityServicesStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener, @Nullable android.os.Handler);
    method @Nullable @RequiresPermission("android.permission.MANAGE_ACCESSIBILITY") public String getAccessibilityShortcutService();
    method @RequiresPermission("android.permission.MANAGE_ACCESSIBILITY") public void performAccessibilityShortcut();
    method public void removeAccessibilityServicesStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener);
  }

  public static interface AccessibilityManager.AccessibilityServicesStateChangeListener {
    method public void onAccessibilityServicesStateChanged(android.view.accessibility.AccessibilityManager);
  }

  public class AccessibilityNodeInfo implements android.os.Parcelable {
    method public static void setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger);
    method public void writeToParcelNoRecycle(android.os.Parcel, int);
  }

  public static final class AccessibilityNodeInfo.TouchDelegateInfo implements android.os.Parcelable {
    method public long getAccessibilityIdForRegion(@NonNull android.graphics.Region);
  }

  public final class AccessibilityWindowInfo implements android.os.Parcelable {
    method public static void setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger);
  }

}

package android.view.animation {

  public class AnimationUtils {
    method public static void lockAnimationClock(long);
    method public static void unlockAnimationClock();
  }

}

package android.view.autofill {

  public final class AutofillId implements android.os.Parcelable {
    ctor public AutofillId(int);
    ctor public AutofillId(@NonNull android.view.autofill.AutofillId, int);
    ctor public AutofillId(int, int);
    ctor public AutofillId(@NonNull android.view.autofill.AutofillId, long, int);
    method public boolean equalsIgnoreSession(@Nullable android.view.autofill.AutofillId);
  }

  public final class AutofillManager {
    method public void setAugmentedAutofillWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
    field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes";
    field public static final int FLAG_SMART_SUGGESTION_OFF = 0; // 0x0
    field public static final int FLAG_SMART_SUGGESTION_SYSTEM = 1; // 0x1
    field public static final int MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS = 120000; // 0x1d4c0
  }

}

package android.view.contentcapture {

  public final class ContentCaptureContext implements android.os.Parcelable {
    method @Nullable public android.content.ComponentName getActivityComponent();
    method public int getDisplayId();
    method public int getFlags();
    method @Nullable public android.view.contentcapture.ContentCaptureSessionId getParentSessionId();
    method public int getTaskId();
    field public static final int FLAG_DISABLED_BY_APP = 1; // 0x1
    field public static final int FLAG_DISABLED_BY_FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_RECONNECTED = 4; // 0x4
  }

  public final class ContentCaptureEvent implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.view.contentcapture.ContentCaptureContext getContentCaptureContext();
    method public long getEventTime();
    method @Nullable public android.view.autofill.AutofillId getId();
    method @Nullable public java.util.List<android.view.autofill.AutofillId> getIds();
    method @Nullable public CharSequence getText();
    method public int getType();
    method @Nullable public android.view.contentcapture.ViewNode getViewNode();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureEvent> CREATOR;
    field public static final int TYPE_CONTEXT_UPDATED = 6; // 0x6
    field public static final int TYPE_SESSION_PAUSED = 8; // 0x8
    field public static final int TYPE_SESSION_RESUMED = 7; // 0x7
    field public static final int TYPE_VIEW_APPEARED = 1; // 0x1
    field public static final int TYPE_VIEW_DISAPPEARED = 2; // 0x2
    field public static final int TYPE_VIEW_TEXT_CHANGED = 3; // 0x3
    field public static final int TYPE_VIEW_TREE_APPEARED = 5; // 0x5
    field public static final int TYPE_VIEW_TREE_APPEARING = 4; // 0x4
  }

  public final class ContentCaptureManager {
    method public boolean isContentCaptureFeatureEnabled();
    field public static final String DEVICE_CONFIG_PROPERTY_IDLE_FLUSH_FREQUENCY = "idle_flush_frequency";
    field public static final String DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL = "logging_level";
    field public static final String DEVICE_CONFIG_PROPERTY_LOG_HISTORY_SIZE = "log_history_size";
    field public static final String DEVICE_CONFIG_PROPERTY_MAX_BUFFER_SIZE = "max_buffer_size";
    field public static final String DEVICE_CONFIG_PROPERTY_SERVICE_EXPLICITLY_ENABLED = "service_explicitly_enabled";
    field public static final String DEVICE_CONFIG_PROPERTY_TEXT_CHANGE_FLUSH_FREQUENCY = "text_change_flush_frequency";
    field public static final int LOGGING_LEVEL_DEBUG = 1; // 0x1
    field public static final int LOGGING_LEVEL_OFF = 0; // 0x0
    field public static final int LOGGING_LEVEL_VERBOSE = 2; // 0x2
  }

  public final class ViewNode extends android.app.assist.AssistStructure.ViewNode {
    method @Nullable public android.view.autofill.AutofillId getParentAutofillId();
    method @Nullable public static android.view.contentcapture.ViewNode readFromParcel(@NonNull android.os.Parcel);
    method public static void writeToParcel(@NonNull android.os.Parcel, @Nullable android.view.contentcapture.ViewNode, int);
  }

  public static final class ViewNode.ViewStructureImpl extends android.view.ViewStructure {
    ctor public ViewNode.ViewStructureImpl(@NonNull android.view.View);
    ctor public ViewNode.ViewStructureImpl(@NonNull android.view.autofill.AutofillId, long, int);
    method public int addChildCount(int);
    method public void asyncCommit();
    method public android.view.ViewStructure asyncNewChild(int);
    method public android.view.autofill.AutofillId getAutofillId();
    method public int getChildCount();
    method public android.os.Bundle getExtras();
    method public CharSequence getHint();
    method public android.view.contentcapture.ViewNode getNode();
    method public android.graphics.Rect getTempRect();
    method public CharSequence getText();
    method public int getTextSelectionEnd();
    method public int getTextSelectionStart();
    method public boolean hasExtras();
    method public android.view.ViewStructure newChild(int);
    method public android.view.ViewStructure.HtmlInfo.Builder newHtmlInfoBuilder(String);
    method public void setAccessibilityFocused(boolean);
    method public void setActivated(boolean);
    method public void setAlpha(float);
    method public void setAssistBlocked(boolean);
    method public void setAutofillHints(String[]);
    method public void setAutofillId(android.view.autofill.AutofillId);
    method public void setAutofillId(android.view.autofill.AutofillId, int);
    method public void setAutofillOptions(CharSequence[]);
    method public void setAutofillType(int);
    method public void setAutofillValue(android.view.autofill.AutofillValue);
    method public void setCheckable(boolean);
    method public void setChecked(boolean);
    method public void setChildCount(int);
    method public void setClassName(String);
    method public void setClickable(boolean);
    method public void setContentDescription(CharSequence);
    method public void setContextClickable(boolean);
    method public void setDataIsSensitive(boolean);
    method public void setDimens(int, int, int, int, int, int);
    method public void setElevation(float);
    method public void setEnabled(boolean);
    method public void setFocusable(boolean);
    method public void setFocused(boolean);
    method public void setHint(CharSequence);
    method public void setHtmlInfo(android.view.ViewStructure.HtmlInfo);
    method public void setId(int, String, String, String);
    method public void setInputType(int);
    method public void setLocaleList(android.os.LocaleList);
    method public void setLongClickable(boolean);
    method public void setOpaque(boolean);
    method public void setSelected(boolean);
    method public void setText(CharSequence);
    method public void setText(CharSequence, int, int);
    method public void setTextLines(int[], int[]);
    method public void setTextStyle(float, int, int, int);
    method public void setTransformation(android.graphics.Matrix);
    method public void setVisibility(int);
    method public void setWebDomain(String);
  }

}

package android.view.inputmethod {

  public final class InputMethodManager {
    method public int getDisplayId();
    method public boolean isInputMethodPickerShown();
  }

}

package android.view.inspector {

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD}) public @interface InspectableProperty {
    method public abstract int attributeId() default android.content.res.Resources.ID_NULL;
    method public abstract android.view.inspector.InspectableProperty.EnumEntry[] enumMapping() default {};
    method public abstract android.view.inspector.InspectableProperty.FlagEntry[] flagMapping() default {};
    method public abstract boolean hasAttributeId() default true;
    method public abstract String name() default "";
    method public abstract android.view.inspector.InspectableProperty.ValueType valueType() default android.view.inspector.InspectableProperty.ValueType.INFERRED;
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface InspectableProperty.EnumEntry {
    method public abstract String name();
    method public abstract int value();
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface InspectableProperty.FlagEntry {
    method public abstract int mask() default 0;
    method public abstract String name();
    method public abstract int target();
  }

  public enum InspectableProperty.ValueType {
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType COLOR;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType GRAVITY;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INFERRED;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_ENUM;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_FLAG;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType NONE;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType RESOURCE_ID;
  }

}

package android.widget {

  public abstract class AbsListView extends android.widget.AdapterView<android.widget.ListAdapter> implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener {
    method public final boolean shouldDrawSelector();
  }

  public class CalendarView extends android.widget.FrameLayout {
    method public boolean getBoundsForDate(long, android.graphics.Rect);
  }

  public class DatePicker extends android.widget.FrameLayout {
    method @android.view.inspector.InspectableProperty(name="datePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumEntry(value=android.widget.DatePicker.MODE_SPINNER, name="spinner"), @android.view.inspector.InspectableProperty.EnumEntry(value=android.widget.DatePicker.MODE_CALENDAR, name="calendar")}) public int getMode();
    field public static final int MODE_CALENDAR = 2; // 0x2
    field public static final int MODE_SPINNER = 1; // 0x1
  }

  @UiThread public final class Magnifier {
    method @Nullable public android.graphics.Bitmap getContent();
    method public static android.graphics.PointF getMagnifierDefaultSize();
    method @Nullable public android.graphics.Bitmap getOriginalContent();
    method public void setOnOperationCompleteCallback(android.widget.Magnifier.Callback);
  }

  public static interface Magnifier.Callback {
    method public void onOperationComplete();
  }

  public class NumberPicker extends android.widget.LinearLayout {
    method public CharSequence getDisplayedValueForCurrentSelection();
  }

  public class PopupMenu {
    method public android.widget.ListView getMenuListView();
  }

  public class Spinner extends android.widget.AbsSpinner implements android.content.DialogInterface.OnClickListener {
    method public boolean isPopupShowing();
  }

  @android.widget.RemoteViews.RemoteView public class TextClock extends android.widget.TextView {
    method public void disableClockTick();
  }

  public class TimePicker extends android.widget.FrameLayout {
    method public android.view.View getAmView();
    method public android.view.View getHourView();
    method public android.view.View getMinuteView();
    method @android.view.inspector.InspectableProperty(name="timePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumEntry(name="clock", value=android.widget.TimePicker.MODE_CLOCK), @android.view.inspector.InspectableProperty.EnumEntry(name="spinner", value=android.widget.TimePicker.MODE_SPINNER)}) public int getMode();
    method public android.view.View getPmView();
    field public static final int MODE_CLOCK = 2; // 0x2
    field public static final int MODE_SPINNER = 1; // 0x1
  }

  public class Toolbar extends android.view.ViewGroup {
    method @Nullable public android.view.View getNavigationView();
  }

}

