// 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 BIND_CELL_BROADCAST_SERVICE = "android.permission.BIND_CELL_BROADCAST_SERVICE";
    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 CONTROL_DEVICE_LIGHTS = "android.permission.CONTROL_DEVICE_LIGHTS";
    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_CRATES = "android.permission.MANAGE_CRATES";
    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 @Deprecated 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 Manifest.permission_group {
    field public static final String UNDEFINED = "android.permission-group.UNDEFINED";
  }

  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
    field public static final int config_systemGallery = 17039402; // 0x104002a
  }

}

package android.accessibilityservice {

  public final class AccessibilityGestureEvent implements android.os.Parcelable {
    ctor public AccessibilityGestureEvent(int, int);
  }

}

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 public static boolean isHighEndGfx();
    method @RequiresPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) public void killProcessesWhenImperceptible(@NonNull int[], @NonNull String);
    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);
    method @RequiresPermission("android.permission.MANAGE_USERS") public boolean switchUser(@NonNull android.os.UserHandle);
    field public static final int PROCESS_CAPABILITY_ALL = 7; // 0x7
    field public static final int PROCESS_CAPABILITY_ALL_EXPLICIT = 1; // 0x1
    field public static final int PROCESS_CAPABILITY_ALL_IMPLICIT = 6; // 0x6
    field public static final int PROCESS_CAPABILITY_FOREGROUND_CAMERA = 2; // 0x2
    field public static final int PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1; // 0x1
    field public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 4; // 0x4
    field public static final int PROCESS_CAPABILITY_NONE = 0; // 0x0
  }

  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 static void setExitTransitionTimeout(long);
    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 requestPictureInPictureMode(@NonNull android.os.IBinder);
    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 resizePinnedStack(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, @Nullable android.content.Intent, @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 @NonNull @RequiresPermission("android.permission.GET_APP_OPS_STATS") public java.util.List<android.app.AppOpsManager.PackageOps> getOpsForPackage(int, @NonNull String, @Nullable java.lang.String...);
    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 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_READ_MEDIA_AUDIO = "android:read_media_audio";
    field public static final String OPSTR_READ_MEDIA_IMAGES = "android:read_media_images";
    field public static final String OPSTR_READ_MEDIA_VIDEO = "android:read_media_video";
    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_MEDIA_AUDIO = "android:write_media_audio";
    field public static final String OPSTR_WRITE_MEDIA_IMAGES = "android:write_media_images";
    field public static final String OPSTR_WRITE_MEDIA_VIDEO = "android:write_media_video";
    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 @Deprecated 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.HistoricalFeatureOps implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getFeatureId();
    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 public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalFeatureOps> CREATOR;
  }

  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, @Nullable String, int, int, long);
    method public void increaseAccessDuration(int, int, @NonNull String, @Nullable String, int, int, long);
    method public void increaseRejectCount(int, int, @NonNull String, @Nullable 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 setFeatureId(@Nullable String);
    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 @IntRange(from=0) public int getFeatureCount();
    method @Nullable public android.app.AppOpsManager.HistoricalFeatureOps getFeatureOps(@NonNull String);
    method @NonNull public android.app.AppOpsManager.HistoricalFeatureOps getFeatureOpsAt(@IntRange(from=0) int);
    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 final class AppOpsManager.OpEntry implements android.os.Parcelable {
    method public int describeContents();
    method @Deprecated public long getDuration();
    method @NonNull public java.util.Map<java.lang.String,android.app.AppOpsManager.OpFeatureEntry> getFeatures();
    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 @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastBackgroundProxyInfo(int);
    method public long getLastDuration(int);
    method public long getLastDuration(int, int, int);
    method public long getLastForegroundDuration(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastForegroundProxyInfo(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastProxyInfo(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastProxyInfo(int, int, 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 @Deprecated @Nullable public String getProxyPackageName();
    method @Deprecated @Nullable public String getProxyPackageName(int, int);
    method @Deprecated public int getProxyUid();
    method @Deprecated 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 static final class AppOpsManager.OpEventProxyInfo implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getFeatureId();
    method @Nullable public String getPackageName();
    method @IntRange(from=0) public int getUid();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpEventProxyInfo> CREATOR;
  }

  public static final class AppOpsManager.OpFeatureEntry implements android.os.Parcelable {
    method public int describeContents();
    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 @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastBackgroundProxyInfo(int);
    method public long getLastDuration(int);
    method public long getLastDuration(int, int, int);
    method public long getLastForegroundDuration(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastForegroundProxyInfo(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastProxyInfo(int);
    method @Nullable public android.app.AppOpsManager.OpEventProxyInfo getLastProxyInfo(int, int, 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 boolean isRunning();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpFeatureEntry> CREATOR;
  }

  public static final class AppOpsManager.PackageOps implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<android.app.AppOpsManager.OpEntry> getOps();
    method @NonNull public String getPackageName();
    method public int getUid();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.PackageOps> CREATOR;
  }

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

  public final class NotificationChannel implements android.os.Parcelable {
    method public int getOriginalImportance();
    method public boolean isBlockableSystem();
    method public boolean isImportanceLockedByCriticalDeviceFunction();
    method public boolean isImportanceLockedByOEM();
    method public void setBlockableSystem(boolean);
    method public void setDeleted(boolean);
    method public void setFgServiceShown(boolean);
    method public void setImportanceLockedByCriticalDeviceFunction(boolean);
    method public void setImportanceLockedByOEM(boolean);
    method public void setOriginalImportance(int);
  }

  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 public void collapsePanels();
    method public void expandNotificationsPanel();
    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);
    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setDisabledForSimNetworkLock(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 @RequiresPermission("android.permission.ENTER_CAR_MODE_PRIORITIZED") public void enableCarMode(@IntRange(from=0) int, int);
    method public boolean isNightModeLocked();
    method public boolean isUiModeLocked();
  }

  public class WallpaperManager {
    method @Nullable public android.graphics.Bitmap getBitmap();
    method @RequiresPermission("android.permission.SET_WALLPAPER_COMPONENT") public boolean setWallpaperComponent(android.content.ComponentName);
    method public boolean shouldEnableWideColorGamut();
    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public boolean wallpaperSupportsWcg(int);
  }

  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_MULTI_WINDOW = 6; // 0x6
    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 public static final int ACTION_UNPIN = 4; // 0x4
    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);
    method @NonNull @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForPackage(@NonNull java.util.UUID, @NonNull String, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
    method @NonNull @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForUid(@NonNull java.util.UUID, int) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_CRATES) @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
  }

  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.companion {

  public final class CompanionDeviceManager {
    method @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES") public boolean isDeviceAssociatedForWifiConnection(@NonNull String, @NonNull android.net.MacAddress, @NonNull android.os.UserHandle);
  }

}

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 long appDisabledExpiration;
    field public boolean augmentedAutofillEnabled;
    field public final boolean compatModeEnabled;
    field @Nullable public android.util.ArrayMap<java.lang.String,java.lang.Long> disabledActivities;
    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 abstract class ContentProvider implements android.content.ComponentCallbacks2 {
    method @NonNull public static android.os.UserHandle getUserHandleFromUri(@NonNull android.net.Uri);
  }

  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 @NonNull public android.content.Context createContextAsUser(@NonNull android.os.UserHandle, int);
    method @NonNull public android.content.Context createPackageContextAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method @NonNull public java.io.File getCrateDir(@NonNull String);
    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);
    method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public void startActivityAsUser(@NonNull @RequiresPermission android.content.Intent, @NonNull android.os.UserHandle);
    field public static final String BUGREPORT_SERVICE = "bugreport";
    field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
    field public static final String DEVICE_IDLE_CONTROLLER = "deviceidle";
    field public static final String ETHERNET_SERVICE = "ethernet";
    field public static final String NETWORK_STACK_SERVICE = "network_stack";
    field public static final String PERMISSION_SERVICE = "permission";
    field public static final String POWER_WHITELIST_MANAGER = "power_whitelist";
    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 int getDisplayId();
  }

  public class Intent implements java.lang.Cloneable android.os.Parcelable {
    field @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public static final String ACTION_MANAGE_DEFAULT_APP = "android.intent.action.MANAGE_DEFAULT_APP";
    field public static final String ACTION_ROLLBACK_COMMITTED = "android.intent.action.ROLLBACK_COMMITTED";
    field public static final String EXTRA_ORIGINATING_UID = "android.intent.extra.ORIGINATING_UID";
    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 public int getRollbackDataPolicy();
    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 public void setEnableRollback(boolean, int);
    method @RequiresPermission("android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS") public void setGrantedRuntimePermissions(String[]);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setInstallAsApex();
    method public void setInstallerPackageName(@Nullable String);
    method public void setRequestDowngrade(boolean);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setStaged();
  }

  public abstract class PackageManager {
    method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void addOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener);
    method public abstract boolean arePermissionsIndividuallyControlled();
    method @Nullable public String getContentCaptureServicePackageName();
    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[] getTelephonyPackageNames();
    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.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void removeOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener);
    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_REVOKED_COMPAT = 8; // 0x8
    field @Deprecated 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 static interface PackageManager.OnPermissionsChangedListener {
    method public void onPermissionsChanged(int);
  }

  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_COMPANION = 8388608; // 0x800000
    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_TELEPHONY = 4194304; // 0x400000
    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 String getLastResourceResolution();
    method @Nullable public String getOverlayablesToString(String);
    method public void setResourceResolutionLoggingEnabled(boolean);
  }

  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(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void blockRollbackManager(long);
    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 @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) 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 @Deprecated 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
  }

  public final class CameraManager {
    method public String[] getCameraIdListNoLazy() throws android.hardware.camera2.CameraAccessException;
  }

}

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 float getShortTermModelLowerLuxMultiplier();
    method public long getShortTermModelTimeoutMillis();
    method public float getShortTermModelUpperLuxMultiplier();
    method public boolean shouldCollectColorSamples();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
    field public static final long SHORT_TERM_TIMEOUT_UNSET = -1L; // 0xffffffffffffffffL
  }

  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);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setShortTermModelLowerLuxMultiplier(@FloatRange(from=0.0f) float);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setShortTermModelTimeoutMillis(long);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setShortTermModelUpperLuxMultiplier(@FloatRange(from=0.0f) float);
    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setShouldCollectColorSamples(boolean);
  }

  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 public boolean isMinimalPostProcessingRequested(int);
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
  }

}

package android.hardware.lights {

  public final class Light implements android.os.Parcelable {
    method public int describeContents();
    method public int getId();
    method public int getOrdinal();
    method public int getType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.lights.Light> CREATOR;
  }

  public final class LightState implements android.os.Parcelable {
    ctor public LightState(@ColorInt int);
    method public int describeContents();
    method @ColorInt public int getColor();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.lights.LightState> CREATOR;
  }

  public final class LightsManager {
    method @NonNull @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public android.hardware.lights.LightState getLightState(@NonNull android.hardware.lights.Light);
    method @NonNull @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public java.util.List<android.hardware.lights.Light> getLights();
    method @NonNull @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public android.hardware.lights.LightsManager.LightsSession openSession();
    field public static final int LIGHT_TYPE_MICROPHONE = 8; // 0x8
  }

  public final class LightsManager.LightsSession implements java.lang.AutoCloseable {
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void close();
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void setLights(@NonNull android.hardware.lights.LightsRequest);
  }

  public final class LightsRequest {
  }

  public static final class LightsRequest.Builder {
    ctor public LightsRequest.Builder();
    method @NonNull public android.hardware.lights.LightsRequest build();
    method @NonNull public android.hardware.lights.LightsRequest.Builder clearLight(@NonNull android.hardware.lights.Light);
    method @NonNull public android.hardware.lights.LightsRequest.Builder setLight(@NonNull android.hardware.lights.Light, @NonNull android.hardware.lights.LightState);
  }

}

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 resetReferenceCarrierFrequencyHzForIsb();
    method public void resetReferenceCodeTypeForIsb();
    method public void resetReferenceConstellationTypeForIsb();
    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 setReferenceCarrierFrequencyHzForIsb(@FloatRange(from=0.0) double);
    method public void setReferenceCodeTypeForIsb(@NonNull String);
    method public void setReferenceConstellationTypeForIsb(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 public void resetBasebandCn0DbHz();
    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 resetReceiverInterSignalBiasNanos();
    method public void resetReceiverInterSignalBiasUncertaintyNanos();
    method public void resetSatelliteInterSignalBiasNanos();
    method public void resetSatelliteInterSignalBiasUncertaintyNanos();
    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 public void setBasebandCn0DbHz(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 setReceiverInterSignalBiasNanos(double);
    method public void setReceiverInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
    method public void setSatelliteInterSignalBiasNanos(double);
    method public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
    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();
    field public static final String EXTRA_NO_GPS_LOCATION = "noGPSLocation";
  }

  public class LocationManager {
    method @NonNull public String[] getBackgroundThrottlingWhitelist();
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void getCurrentLocation(@NonNull android.location.LocationRequest, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.location.Location>);
    method @NonNull public String[] getIgnoreSettingsWhitelist();
    method @Nullable @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public java.util.List<java.lang.String> getProviderPackages(@NonNull String);
    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(@Nullable 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(@Nullable android.location.LocationRequest, @NonNull java.util.concurrent.Executor, @NonNull android.location.LocationListener);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@Nullable android.location.LocationRequest, @NonNull android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, @NonNull android.os.UserHandle);
    field public static final String FUSED_PROVIDER = "fused";
  }

  public final class LocationRequest implements android.os.Parcelable {
    method @NonNull public static android.location.LocationRequest create();
    method public int describeContents();
    method @Deprecated public long getExpireAt();
    method public long getExpireIn();
    method public long getFastestInterval();
    method public long getInterval();
    method public int getNumUpdates();
    method public int getQuality();
    method public boolean isLocationSettingsIgnored();
    method public boolean isLowPowerMode();
    method @Deprecated @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 @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.location.LocationRequest setLocationSettingsIgnored(boolean);
    method @NonNull public android.location.LocationRequest setLowPowerMode(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 MediaRoute2Info implements android.os.Parcelable {
    method @NonNull public String getOriginalId();
  }

  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
    field public static final int RULE_MATCH_USERID = 8; // 0x8
  }

  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 boolean removeUserIdDeviceAffinity(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 boolean setUserIdDeviceAffinity(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 reevaluateNetwork();
    method public void useNetwork();
    field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64
    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 final class CaptivePortalData implements android.os.Parcelable {
    method public int describeContents();
    method public long getByteLimit();
    method public long getExpiryTimeMillis();
    method public long getRefreshTimeMillis();
    method @Nullable public android.net.Uri getUserPortalUrl();
    method @Nullable public android.net.Uri getVenueInfoUrl();
    method public boolean isCaptive();
    method public boolean isSessionExtendable();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.CaptivePortalData> CREATOR;
  }

  public static class CaptivePortalData.Builder {
    ctor public CaptivePortalData.Builder();
    ctor public CaptivePortalData.Builder(@Nullable android.net.CaptivePortalData);
    method @NonNull public android.net.CaptivePortalData build();
    method @NonNull public android.net.CaptivePortalData.Builder setBytesRemaining(long);
    method @NonNull public android.net.CaptivePortalData.Builder setCaptive(boolean);
    method @NonNull public android.net.CaptivePortalData.Builder setExpiryTime(long);
    method @NonNull public android.net.CaptivePortalData.Builder setRefreshTime(long);
    method @NonNull public android.net.CaptivePortalData.Builder setSessionExtendable(boolean);
    method @NonNull public android.net.CaptivePortalData.Builder setUserPortalUrl(@Nullable android.net.Uri);
    method @NonNull public android.net.CaptivePortalData.Builder setVenueInfoUrl(@Nullable android.net.Uri);
  }

  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 class EthernetManager {
    method @NonNull public android.net.EthernetManager.TetheredInterfaceRequest requestTetheredInterface(@NonNull android.net.EthernetManager.TetheredInterfaceCallback);
  }

  public static interface EthernetManager.TetheredInterfaceCallback {
    method public void onAvailable(@NonNull String);
    method public void onUnavailable();
  }

  public static class EthernetManager.TetheredInterfaceRequest {
    method public void release();
  }

  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, int, int, long, long);
    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 long getDeprecationTime();
    method public long getExpirationTime();
    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.Uri getCaptivePortalApiUrl();
    method @Nullable public android.net.CaptivePortalData getCaptivePortalData();
    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 @NonNull public android.net.LinkProperties makeSensitiveFieldsParcelingCopy();
    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 setCaptivePortalApiUrl(@Nullable android.net.Uri);
    method public void setCaptivePortalData(@Nullable android.net.CaptivePortalData);
    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 final class NetworkScore implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.net.NetworkScore.Metrics getEndToEndMetrics();
    method @NonNull public android.net.NetworkScore.Metrics getLinkLayerMetrics();
    method public int getRange();
    method @IntRange(from=android.net.NetworkScore.UNKNOWN_SIGNAL_STRENGTH, to=android.net.NetworkScore.MAX_SIGNAL_STRENGTH) public int getSignalStrength();
    method public boolean hasPolicy(int);
    method public boolean isExiting();
    method @NonNull public android.net.NetworkScore withExiting(boolean);
    method @NonNull public android.net.NetworkScore withSignalStrength(@IntRange(from=android.net.NetworkScore.UNKNOWN_SIGNAL_STRENGTH) int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkScore> CREATOR;
    field public static final int MAX_SIGNAL_STRENGTH = 1000; // 0x3e8
    field public static final int MIN_SIGNAL_STRENGTH = 0; // 0x0
    field public static final int POLICY_DEFAULT_SUBSCRIPTION = 8; // 0x8
    field public static final int POLICY_IGNORE_ON_WIFI = 4; // 0x4
    field public static final int POLICY_LOCKDOWN_VPN = 1; // 0x1
    field public static final int POLICY_VPN = 2; // 0x2
    field public static final int RANGE_CLOSE = 1; // 0x1
    field public static final int RANGE_LONG = 4; // 0x4
    field public static final int RANGE_MEDIUM = 3; // 0x3
    field public static final int RANGE_SHORT = 2; // 0x2
    field public static final int RANGE_UNKNOWN = 0; // 0x0
    field public static final int UNKNOWN_SIGNAL_STRENGTH = -1; // 0xffffffff
  }

  public static class NetworkScore.Builder {
    ctor public NetworkScore.Builder();
    method @NonNull public android.net.NetworkScore.Builder addPolicy(int);
    method @NonNull public android.net.NetworkScore build();
    method @NonNull public android.net.NetworkScore.Builder clearPolicy(int);
    method @NonNull public android.net.NetworkScore.Builder setEndToEndMetrics(@NonNull android.net.NetworkScore.Metrics);
    method @NonNull public android.net.NetworkScore.Builder setExiting(boolean);
    method @NonNull public android.net.NetworkScore.Builder setLegacyScore(int);
    method @NonNull public android.net.NetworkScore.Builder setLinkLayerMetrics(@NonNull android.net.NetworkScore.Metrics);
    method @NonNull public android.net.NetworkScore.Builder setRange(int);
    method @NonNull public android.net.NetworkScore.Builder setSignalStrength(@IntRange(from=android.net.NetworkScore.UNKNOWN_SIGNAL_STRENGTH, to=android.net.NetworkScore.MAX_SIGNAL_STRENGTH) int);
  }

  public static class NetworkScore.Metrics {
    ctor public NetworkScore.Metrics(@IntRange(from=android.net.NetworkScore.Metrics.LATENCY_UNKNOWN) int, @IntRange(from=android.net.NetworkScore.Metrics.BANDWIDTH_UNKNOWN) int, @IntRange(from=android.net.NetworkScore.Metrics.BANDWIDTH_UNKNOWN) int);
    field public static final int BANDWIDTH_UNKNOWN = -1; // 0xffffffff
    field @NonNull public static final android.net.NetworkScore.Metrics EMPTY;
    field public static final int LATENCY_UNKNOWN = -1; // 0xffffffff
    field @IntRange(from=android.net.NetworkScore.Metrics.BANDWIDTH_UNKNOWN) public final int downlinkBandwidthKBps;
    field @IntRange(from=android.net.NetworkScore.Metrics.LATENCY_UNKNOWN) public final int latencyMs;
    field @IntRange(from=android.net.NetworkScore.Metrics.BANDWIDTH_UNKNOWN) public final int uplinkBandwidthKBps;
  }

  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 final class TetheredClient implements android.os.Parcelable {
    ctor public TetheredClient(@NonNull android.net.MacAddress, @NonNull java.util.Collection<android.net.TetheredClient.AddressInfo>, int);
    method public int describeContents();
    method @NonNull public java.util.List<android.net.TetheredClient.AddressInfo> getAddresses();
    method @NonNull public android.net.MacAddress getMacAddress();
    method public int getTetheringType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.TetheredClient> CREATOR;
  }

  public static final class TetheredClient.AddressInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.net.LinkAddress getAddress();
    method @Nullable public String getHostname();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.TetheredClient.AddressInfo> CREATOR;
  }

  public class TetheringManager {
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerTetheringEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.TetheringManager.TetheringEventCallback);
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.WRITE_SETTINGS}) public void requestLatestTetheringEntitlementResult(int, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.net.TetheringManager.OnTetheringEntitlementResultListener);
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.WRITE_SETTINGS}) public void startTethering(@NonNull android.net.TetheringManager.TetheringRequest, @NonNull java.util.concurrent.Executor, @NonNull android.net.TetheringManager.StartTetheringCallback);
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.WRITE_SETTINGS}) public void startTethering(int, @NonNull java.util.concurrent.Executor, @NonNull android.net.TetheringManager.StartTetheringCallback);
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.WRITE_SETTINGS}) public void stopAllTethering();
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.WRITE_SETTINGS}) public void stopTethering(int);
    method @RequiresPermission(anyOf={"android.permission.TETHER_PRIVILEGED", android.Manifest.permission.ACCESS_NETWORK_STATE}) public void unregisterTetheringEventCallback(@NonNull android.net.TetheringManager.TetheringEventCallback);
    field public static final String ACTION_TETHER_STATE_CHANGED = "android.net.conn.TETHER_STATE_CHANGED";
    field public static final String EXTRA_ACTIVE_LOCAL_ONLY = "android.net.extra.ACTIVE_LOCAL_ONLY";
    field public static final String EXTRA_ACTIVE_TETHER = "tetherArray";
    field public static final String EXTRA_AVAILABLE_TETHER = "availableArray";
    field public static final String EXTRA_ERRORED_TETHER = "erroredArray";
    field public static final int TETHERING_BLUETOOTH = 2; // 0x2
    field public static final int TETHERING_ETHERNET = 5; // 0x5
    field public static final int TETHERING_INVALID = -1; // 0xffffffff
    field public static final int TETHERING_NCM = 4; // 0x4
    field public static final int TETHERING_USB = 1; // 0x1
    field public static final int TETHERING_WIFI = 0; // 0x0
    field public static final int TETHERING_WIFI_P2P = 3; // 0x3
    field public static final int TETHER_ERROR_DHCPSERVER_ERROR = 12; // 0xc
    field public static final int TETHER_ERROR_DISABLE_NAT_ERROR = 9; // 0x9
    field public static final int TETHER_ERROR_ENABLE_NAT_ERROR = 8; // 0x8
    field public static final int TETHER_ERROR_ENTITLEMENT_UNKNOWN = 13; // 0xd
    field public static final int TETHER_ERROR_IFACE_CFG_ERROR = 10; // 0xa
    field public static final int TETHER_ERROR_MASTER_ERROR = 5; // 0x5
    field public static final int TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION = 15; // 0xf
    field public static final int TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION = 14; // 0xe
    field public static final int TETHER_ERROR_NO_ERROR = 0; // 0x0
    field public static final int TETHER_ERROR_PROVISION_FAILED = 11; // 0xb
    field public static final int TETHER_ERROR_SERVICE_UNAVAIL = 2; // 0x2
    field public static final int TETHER_ERROR_TETHER_IFACE_ERROR = 6; // 0x6
    field public static final int TETHER_ERROR_UNAVAIL_IFACE = 4; // 0x4
    field public static final int TETHER_ERROR_UNKNOWN_IFACE = 1; // 0x1
    field public static final int TETHER_ERROR_UNSUPPORTED = 3; // 0x3
    field public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR = 7; // 0x7
  }

  public static interface TetheringManager.OnTetheringEntitlementResultListener {
    method public void onTetheringEntitlementResult(int);
  }

  public abstract static class TetheringManager.StartTetheringCallback {
    ctor public TetheringManager.StartTetheringCallback();
    method public void onTetheringFailed(int);
    method public void onTetheringStarted();
  }

  public abstract static class TetheringManager.TetheringEventCallback {
    ctor public TetheringManager.TetheringEventCallback();
    method public void onClientsChanged(@NonNull java.util.Collection<android.net.TetheredClient>);
    method public void onError(@NonNull String, int);
    method @Deprecated public void onTetherableInterfaceRegexpsChanged(@NonNull android.net.TetheringManager.TetheringInterfaceRegexps);
    method public void onTetherableInterfacesChanged(@NonNull java.util.List<java.lang.String>);
    method public void onTetheredInterfacesChanged(@NonNull java.util.List<java.lang.String>);
    method public void onTetheringSupported(boolean);
    method public void onUpstreamChanged(@Nullable android.net.Network);
  }

  @Deprecated public static class TetheringManager.TetheringInterfaceRegexps {
    ctor @Deprecated public TetheringManager.TetheringInterfaceRegexps(@NonNull String[], @NonNull String[], @NonNull String[]);
    method @Deprecated @NonNull public java.util.List<java.lang.String> getTetherableBluetoothRegexs();
    method @Deprecated @NonNull public java.util.List<java.lang.String> getTetherableUsbRegexs();
    method @Deprecated @NonNull public java.util.List<java.lang.String> getTetherableWifiRegexs();
  }

  public static class TetheringManager.TetheringRequest {
  }

  public static class TetheringManager.TetheringRequest.Builder {
    ctor public TetheringManager.TetheringRequest.Builder(int);
    method @NonNull public android.net.TetheringManager.TetheringRequest build();
    method @NonNull @RequiresPermission("android.permission.TETHER_PRIVILEGED") public android.net.TetheringManager.TetheringRequest.Builder setExemptFromEntitlementCheck(boolean);
    method @NonNull @RequiresPermission("android.permission.TETHER_PRIVILEGED") public android.net.TetheringManager.TetheringRequest.Builder setSilentProvisioning(boolean);
    method @NonNull @RequiresPermission("android.permission.TETHER_PRIVILEGED") public android.net.TetheringManager.TetheringRequest.Builder useStaticIpv4Addresses(@NonNull android.net.LinkAddress);
  }

  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 @Deprecated @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, 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 requestBugreport(@NonNull android.os.BugreportParams, @Nullable CharSequence, @Nullable CharSequence);
    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();
  }

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

  public class HidlMemory implements java.io.Closeable {
    ctor public HidlMemory(@NonNull String, @IntRange(from=0) long, @Nullable android.os.NativeHandle);
    method public void close() throws java.io.IOException;
    method @NonNull public android.os.HidlMemory dup() throws java.io.IOException;
    method protected void finalize();
    method @Nullable public android.os.NativeHandle getHandle();
    method @NonNull public String getName();
    method public long getSize();
    method @Nullable public android.os.NativeHandle releaseHandle();
  }

  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 long getFieldHandle(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 putHidlMemory(long, @NonNull android.os.HidlMemory);
    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 @NonNull @Nullable public final android.os.HidlMemory readEmbeddedHidlMemory(long, long, long);
    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 @NonNull public final android.os.HidlMemory readHidlMemory();
    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 writeHidlMemory(@NonNull android.os.HidlMemory);
    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
  }

  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 @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
    method @NonNull @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) 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 public void registerSection(int, @NonNull String, @NonNull android.os.IncidentManager.DumpCallback);
    method public void registerSection(int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.os.IncidentManager.DumpCallback);
    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);
    method public void unregisterSection(int);
    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.DumpCallback {
    ctor public IncidentManager.DumpCallback();
    method public void onDumpSection(int, @NonNull java.io.OutputStream);
  }

  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 PowerWhitelistManager {
    method @RequiresPermission("android.permission.DEVICE_POWER") public boolean addToWhitelist(@NonNull String);
    method @RequiresPermission("android.permission.DEVICE_POWER") public int addToWhitelist(@NonNull java.util.List<java.lang.String>);
    method @RequiresPermission("android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST") public void whitelistAppTemporarily(@NonNull String, long);
    method @RequiresPermission("android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST") public long whitelistAppTemporarilyForEvent(@NonNull String, int, @NonNull String);
    field public static final int EVENT_MMS = 2; // 0x2
    field public static final int EVENT_SMS = 1; // 0x1
    field public static final int EVENT_UNSPECIFIED = 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 SystemConfigManager {
    method @NonNull @RequiresPermission("android.permission.READ_CARRIER_APP_INFO") public java.util.Set<java.lang.String> getDisabledUntilUsedPreinstalledCarrierApps();
    method @NonNull @RequiresPermission("android.permission.READ_CARRIER_APP_INFO") public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getDisabledUntilUsedPreinstalledCarrierAssociatedApps();
  }

  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);
    method public static int getInt(@NonNull String, int);
    method public static long getLong(@NonNull String, long);
  }

  public final class UserHandle implements android.os.Parcelable {
    method public static int getAppId(int);
    method public int getIdentifier();
    method public static int getUid(int, int);
    method public static int getUserId(int);
    method public static boolean isApp(int);
    method public static int myUserId();
    method public static android.os.UserHandle of(int);
    field @NonNull public static final android.os.UserHandle ALL;
    field @NonNull public static final android.os.UserHandle CURRENT;
    field public static final int MIN_SECONDARY_USER_ID = 10; // 0xa
    field @NonNull public static final android.os.UserHandle SYSTEM;
    field public static final int USER_ALL = -1; // 0xffffffff
    field public static final int USER_NULL = -10000; // 0xffffd8f0
    field public static final int USER_SYSTEM = 0; // 0x0
  }

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

  public final class VibrationAttributes implements android.os.Parcelable {
    method @Deprecated @NonNull public android.media.AudioAttributes getAudioAttributes();
  }

  public static final class VibrationAttributes.Builder {
    ctor public VibrationAttributes.Builder(@NonNull android.media.AudioAttributes, @Nullable android.os.VibrationEffect);
  }

  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 @Nullable public String getPackageName(int);
    method public int getUid(int);
    method public boolean isEmpty();
    method @Deprecated public android.os.WorkSource[] setReturningDiffs(android.os.WorkSource);
    method public int size();
    method @NonNull public android.os.WorkSource withoutNames();
  }

}

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 final class CrateInfo implements android.os.Parcelable {
    ctor public CrateInfo(@NonNull CharSequence, long);
    ctor public CrateInfo(@NonNull CharSequence);
    method @Nullable public static android.os.storage.CrateInfo copyFrom(int, @Nullable String, @Nullable String);
    method public int describeContents();
    method public long getExpirationMillis();
    method @NonNull public CharSequence getLabel();
    method public void writeToParcel(@Nullable android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.os.storage.CrateInfo> CREATOR;
  }

  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(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.RESTORE_RUNTIME_PERMISSIONS"}) public void applyStagedRuntimePermissionBackup(@NonNull String, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    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.GET_RUNTIME_PERMISSIONS") public void getRuntimePermissionBackup(@NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<byte[]>);
    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);
    method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.RESTORE_RUNTIME_PERMISSIONS"}) public void stageAndApplyRuntimePermissionsBackup(@NonNull byte[], @NonNull android.os.UserHandle);
    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 PermissionManager {
    method @IntRange(from=0) @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public int getRuntimePermissionsVersion();
    method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions();
    method @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public void setRuntimePermissionsVersion(@IntRange(from=0) int);
  }

  public static final class PermissionManager.SplitPermissionInfo {
    method @NonNull public java.util.List<java.lang.String> getNewPermissions();
    method @NonNull public String getSplitPermission();
    method public int getTargetSdk();
  }

  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 interface AndroidDeviceConfig {
    field public static final String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive";
    field public static final String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";
  }

  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 @NonNull @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static android.provider.DeviceConfig.Properties getProperties(@NonNull String, @NonNull java.lang.String...);
    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 setProperties(@NonNull android.provider.DeviceConfig.Properties) throws android.provider.DeviceConfig.BadConfigException;
    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_ANDROID = "android";
    field public static final String NAMESPACE_AUTOFILL = "autofill";
    field public static final String NAMESPACE_BIOMETRICS = "biometrics";
    field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
    field public static final String NAMESPACE_PERMISSIONS = "permissions";
    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 class DeviceConfig.BadConfigException extends java.lang.Exception {
    ctor public DeviceConfig.BadConfigException();
  }

  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 static final class DeviceConfig.Properties.Builder {
    ctor public DeviceConfig.Properties.Builder(@NonNull String);
    method @NonNull public android.provider.DeviceConfig.Properties build();
    method @NonNull public android.provider.DeviceConfig.Properties.Builder setBoolean(@NonNull String, boolean);
    method @NonNull public android.provider.DeviceConfig.Properties.Builder setFloat(@NonNull String, float);
    method @NonNull public android.provider.DeviceConfig.Properties.Builder setInt(@NonNull String, int);
    method @NonNull public android.provider.DeviceConfig.Properties.Builder setLong(@NonNull String, long);
    method @NonNull public android.provider.DeviceConfig.Properties.Builder setString(@NonNull String, @Nullable String);
  }

  public final class MediaStore {
    method @NonNull public static android.net.Uri scanFile(@NonNull android.content.ContentResolver, @NonNull java.io.File);
    method public static void scanVolume(@NonNull android.content.ContentResolver, @NonNull String);
    method public static void waitForIdle(@NonNull android.content.ContentResolver);
  }

  public final class Settings {
    field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
    field public static final String ACTION_MANAGE_APP_OVERLAY_PERMISSION = "android.settings.MANAGE_APP_OVERLAY_PERMISSION";
    field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
    field public static final String ACTION_TETHER_PROVISIONING_UI = "android.settings.TETHER_PROVISIONING_UI";
    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 APP_OPS_CONSTANTS = "app_ops_constants";
    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 HIDE_ERROR_DIALOGS = "hide_error_dialogs";
    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 NOTIFICATION_BUBBLES = "notification_bubbles";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
    field public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
    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 @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.CellBroadcasts implements android.provider.BaseColumns {
    field public static final String CID = "cid";
    field public static final String CMAS_CATEGORY = "cmas_category";
    field public static final String CMAS_CERTAINTY = "cmas_certainty";
    field public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
    field public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
    field public static final String CMAS_SEVERITY = "cmas_severity";
    field public static final String CMAS_URGENCY = "cmas_urgency";
    field @NonNull public static final android.net.Uri CONTENT_URI;
    field public static final String DATA_CODING_SCHEME = "dcs";
    field public static final String DEFAULT_SORT_ORDER = "date DESC";
    field public static final String DELIVERY_TIME = "date";
    field public static final String ETWS_WARNING_TYPE = "etws_warning_type";
    field public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
    field public static final String GEOMETRIES = "geometries";
    field public static final String LAC = "lac";
    field public static final String LANGUAGE_CODE = "language";
    field public static final String LOCATION_CHECK_TIME = "location_check_time";
    field public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time";
    field public static final String MESSAGE_BODY = "body";
    field public static final String MESSAGE_BROADCASTED = "message_broadcasted";
    field public static final String MESSAGE_DISPLAYED = "message_displayed";
    field public static final String MESSAGE_FORMAT = "format";
    field @NonNull @RequiresPermission(android.Manifest.permission.READ_CELL_BROADCASTS) public static final android.net.Uri MESSAGE_HISTORY_URI;
    field public static final String MESSAGE_PRIORITY = "priority";
    field public static final String MESSAGE_READ = "read";
    field public static final String PLMN = "plmn";
    field public static final String RECEIVED_TIME = "received_time";
    field public static final String SERIAL_NUMBER = "serial_number";
    field public static final String SERVICE_CATEGORY = "service_category";
    field public static final String SLOT_INDEX = "slot_index";
    field public static final String SUBSCRIPTION_ID = "sub_id";
  }

  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 @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") 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
    field public static final int USE_INDIVIDUAL_ATTESTATION = 4; // 0x4
  }

  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 {
    ctor public AutofillFieldClassificationService();
    method public android.os.IBinder onBind(android.content.Intent);
    field public static final String REQUIRED_ALGORITHM_CREDIT_CARD = "CREDIT_CARD";
    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 static final class Dataset.Builder {
    ctor public Dataset.Builder(@NonNull android.service.autofill.InlinePresentation);
    method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.service.autofill.InlinePresentation);
  }

  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 InlineSuggestionRenderService extends android.app.Service {
    ctor public InlineSuggestionRenderService();
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @Nullable public android.view.View onRenderSuggestion(@NonNull android.service.autofill.InlinePresentation, int, int);
    field public static final String SERVICE_INTERFACE = "android.service.autofill.InlineSuggestionRenderService";
  }

  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.view.inputmethod.InlineSuggestionsRequest getInlineSuggestionsRequest();
    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(@Nullable android.service.autofill.augmented.FillWindow);
    method @NonNull public android.service.autofill.augmented.FillResponse.Builder setInlineSuggestions(@Nullable java.util.List<android.service.autofill.Dataset>);
  }

  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_RANKING_SCORE = "key_ranking_score";
    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 onNotificationVisibilityChanged(@NonNull String, boolean);
    method public void onNotificationsSeen(@NonNull java.util.List<java.lang.String>);
    method public void onPanelHidden();
    method public void onPanelRevealed(int);
    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.service.textclassifier {

  public abstract class TextClassifierService extends android.app.Service {
    ctor public TextClassifierService();
    method @NonNull public static android.view.textclassifier.TextClassifier getDefaultTextClassifierImplementation(@NonNull android.content.Context);
    method @Deprecated public final android.view.textclassifier.TextClassifier getLocalTextClassifier();
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @MainThread public abstract void onClassifyText(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassification.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
    method public void onConnected();
    method @MainThread public void onCreateTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext, @NonNull android.view.textclassifier.TextClassificationSessionId);
    method @MainThread public void onDestroyTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationSessionId);
    method @MainThread public void onDetectLanguage(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLanguage.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLanguage>);
    method public void onDisconnected();
    method @MainThread public abstract void onGenerateLinks(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLinks.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
    method @Deprecated @MainThread public void onSelectionEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.SelectionEvent);
    method @MainThread public void onSuggestConversationActions(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.ConversationActions.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.ConversationActions>);
    method @MainThread public abstract void onSuggestSelection(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextSelection.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextSelection>);
    method @MainThread public void onTextClassifierEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassifierEvent);
    field public static final String SERVICE_INTERFACE = "android.service.textclassifier.TextClassifierService";
  }

  public static interface TextClassifierService.Callback<T> {
    method public void onFailure(@NonNull CharSequence);
    method public void onSuccess(T);
  }

}

package android.telecom {

  public final class Call {
    method public void enterBackgroundAudioProcessing();
    method public void exitBackgroundAudioProcessing(boolean);
  }

  public static class Call.Details {
    method public String getTelecomCallId();
  }

  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 static class CallScreeningService.CallResponse.Builder {
    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
  }

  public abstract class Conference extends android.telecom.Conferenceable {
    method public final long getConnectionStartElapsedRealTime();
    method public android.telecom.Connection getPrimaryConnection();
    method @NonNull public final String getTelecomCallId();
    method public final void setAddress(@NonNull android.net.Uri, int);
    method public final void setCallerDisplayName(@NonNull String, int);
    method public void setConferenceState(boolean);
  }

  public abstract class Connection extends android.telecom.Conferenceable {
    method public final long getConnectElapsedTimeMillis();
    method public final long getConnectTimeMillis();
    method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
    method @Nullable public final String getTelecomCallId();
    method public final void resetConnectionTime();
    method public void setCallDirection(int);
    method public final void setConnectTimeMillis(long);
    method public final void setConnectionStartElapsedRealTime(long);
    method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
    method public void setTelecomCallId(@NonNull String);
    field public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 2097152; // 0x200000
    field public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 262144; // 0x40000
    field public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL";
    field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1; // 0x1
    field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
    field public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 64; // 0x40
    field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800
  }

  public final class ConnectionRequest implements android.os.Parcelable {
    method @Nullable public String getTelecomCallId();
  }

  public static final class ConnectionRequest.Builder {
    ctor public ConnectionRequest.Builder();
    method @NonNull public android.telecom.ConnectionRequest build();
    method @NonNull public android.telecom.ConnectionRequest.Builder setAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
    method @NonNull public android.telecom.ConnectionRequest.Builder setAddress(@NonNull android.net.Uri);
    method @NonNull public android.telecom.ConnectionRequest.Builder setExtras(@NonNull android.os.Bundle);
    method @NonNull public android.telecom.ConnectionRequest.Builder setIsAdhocConferenceCall(boolean);
    method @NonNull public android.telecom.ConnectionRequest.Builder setParticipants(@Nullable java.util.List<android.net.Uri>);
    method @NonNull public android.telecom.ConnectionRequest.Builder setRttPipeFromInCall(@NonNull android.os.ParcelFileDescriptor);
    method @NonNull public android.telecom.ConnectionRequest.Builder setRttPipeToInCall(@NonNull android.os.ParcelFileDescriptor);
    method @NonNull public android.telecom.ConnectionRequest.Builder setShouldShowIncomingCallUi(boolean);
    method @NonNull public android.telecom.ConnectionRequest.Builder setTelecomCallId(@NonNull String);
    method @NonNull public android.telecom.ConnectionRequest.Builder setVideoState(int);
  }

  public static class PhoneAccount.Builder {
    method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String);
  }

  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 @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts(boolean);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode();
    method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(int);
    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_INVALID = -1; // 0xffffffff
  }

  public static final class AccessNetworkConstants.NgranBands {
    method public static int getFrequencyRangeGroup(int);
    field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1
    field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2
    field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0
  }

  public final class BarringInfo implements android.os.Parcelable {
    ctor public BarringInfo();
    ctor public BarringInfo(@Nullable android.telephony.CellIdentity, @NonNull android.util.SparseArray<android.telephony.BarringInfo.BarringServiceInfo>);
  }

  public static final class BarringInfo.BarringServiceInfo implements android.os.Parcelable {
    ctor public BarringInfo.BarringServiceInfo(int, boolean, int, int);
  }

  public final class CallQuality implements android.os.Parcelable {
    ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int);
    ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean);
    method public int describeContents();
    method public int getAverageRelativeJitter();
    method public int getAverageRoundTripTime();
    method public int getCallDuration();
    method public int getCodecType();
    method public int getDownlinkCallQualityLevel();
    method public int getMaxRelativeJitter();
    method public int getNumRtpPacketsNotReceived();
    method public int getNumRtpPacketsReceived();
    method public int getNumRtpPacketsTransmitted();
    method public int getNumRtpPacketsTransmittedLost();
    method public int getUplinkCallQualityLevel();
    method public boolean isIncomingSilenceDetected();
    method public boolean isOutgoingSilenceDetected();
    method public boolean isRtpInactivityDetected();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALL_QUALITY_BAD = 4; // 0x4
    field public static final int CALL_QUALITY_EXCELLENT = 0; // 0x0
    field public static final int CALL_QUALITY_FAIR = 2; // 0x2
    field public static final int CALL_QUALITY_GOOD = 1; // 0x1
    field public static final int CALL_QUALITY_NOT_AVAILABLE = 5; // 0x5
    field public static final int CALL_QUALITY_POOR = 3; // 0x3
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallQuality> CREATOR;
  }

  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 @Nullable public android.telephony.DataSpecificRegistrationInfo getDataSpecificInfo();
    method public int getRegistrationState();
    method public int getRejectCause();
    method public int getRoamingType();
    method public boolean isEmergencyEnabled();
    method public void writeToParcel(android.os.Parcel, int);
    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
  }

  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 setRegisteredPlmn(@Nullable String);
    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 PhoneNumberUtils {
    method public static int getMinMatchForTest();
    method @NonNull public static String getUsernameFromUriNumber(@NonNull String);
    method public static boolean isUriNumber(@Nullable String);
    method public static boolean isVoiceMailNumber(@NonNull android.content.Context, int, @Nullable String);
    method public static void setMinMatchForTest(int);
  }

  public class PhoneStateListener {
    method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
    method public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber);
    field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_EMERGENCY_CALL = 268435456; // 0x10000000
    field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_EMERGENCY_SMS = 536870912; // 0x20000000
  }

  public final class PreciseDataConnectionState implements android.os.Parcelable {
    ctor @Deprecated public PreciseDataConnectionState(int, int, int, @NonNull String, @Nullable android.net.LinkProperties, int);
  }

  public class ServiceState implements android.os.Parcelable {
    method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo);
    method public int getDataNetworkType();
    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);
    method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull 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 SubscriptionManager {
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultVoiceSubscriptionId(int);
    field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI;
    field @NonNull public static final android.net.Uri VT_ENABLED_CONTENT_URI;
    field @NonNull public static final android.net.Uri WFC_ENABLED_CONTENT_URI;
    field @NonNull public static final android.net.Uri WFC_MODE_CONTENT_URI;
    field @NonNull public static final android.net.Uri WFC_ROAMING_ENABLED_CONTENT_URI;
    field @NonNull public static final android.net.Uri WFC_ROAMING_MODE_CONTENT_URI;
  }

  public class TelephonyManager {
    method public int addDevicePolicyOverrideApn(@NonNull android.content.Context, @NonNull android.telephony.data.ApnSetting);
    method public int checkCarrierPrivilegesForPackage(String);
    method public int getCarrierIdListVersion();
    method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
    method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
    method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
    method public int getEmergencyNumberDbVersion();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
    method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getNetworkCountryIso(int);
    method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
    method public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting);
    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);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSystemSelectionChannels(@NonNull java.util.List<android.telephony.RadioAccessSpecifier>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Boolean>);
    method @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public void updateTestOtaEmergencyNumberDbFilePath(@NonNull 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 INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; // 0xffffffff
    field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
  }

  public class TelephonyRegistryManager {
    method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor);
    method public void addOnSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener, @NonNull java.util.concurrent.Executor);
    method public void listenForSubscriber(int, @NonNull String, @NonNull String, @NonNull android.telephony.PhoneStateListener, int, boolean);
    method public void notifyActiveDataSubIdChanged(int);
    method public void notifyBarringInfoChanged(int, int, @NonNull android.telephony.BarringInfo);
    method public void notifyCallForwardingChanged(int, boolean);
    method public void notifyCallQualityChanged(int, int, @NonNull android.telephony.CallQuality, int);
    method public void notifyCallStateChanged(int, int, int, @Nullable String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyCallStateChangedForAllSubscriptions(int, @Nullable String);
    method public void notifyCarrierNetworkChange(boolean);
    method public void notifyCellInfoChanged(int, @NonNull java.util.List<android.telephony.CellInfo>);
    method public void notifyCellLocation(int, @NonNull android.telephony.CellIdentity);
    method public void notifyDataActivationStateChanged(int, int, int);
    method public void notifyDataActivityChanged(int, int);
    method public void notifyDataConnectionForSubscriber(int, int, int, @Nullable android.telephony.PreciseDataConnectionState);
    method public void notifyDisconnectCause(int, int, int, int);
    method public void notifyEmergencyNumberList(int, int);
    method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void notifyMessageWaitingChanged(int, int, boolean);
    method public void notifyOutgoingEmergencyCall(int, int, @NonNull android.telephony.emergency.EmergencyNumber);
    method public void notifyOutgoingEmergencySms(int, int, @NonNull android.telephony.emergency.EmergencyNumber);
    method public void notifyPhoneCapabilityChanged(@NonNull android.telephony.PhoneCapability);
    method public void notifyPreciseCallState(int, int, int, int, int);
    method public void notifyPreciseDataConnectionFailed(int, int, int, @Nullable String, int);
    method public void notifyRadioPowerStateChanged(int, int, int);
    method public void notifyRegistrationFailed(int, int, @NonNull android.telephony.CellIdentity, @NonNull String, int, int, int);
    method public void notifyServiceStateChanged(int, int, @NonNull android.telephony.ServiceState);
    method public void notifySignalStrengthChanged(int, int, @NonNull android.telephony.SignalStrength);
    method public void notifySrvccStateChanged(int, int);
    method public void notifyUserMobileDataStateChanged(int, int, boolean);
    method public void notifyVoiceActivationStateChanged(int, int, int);
    method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
    method public void removeOnSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
  }

}

package android.telephony.emergency {

  public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
    field public static final int EMERGENCY_NUMBER_SOURCE_TEST = 32; // 0x20
  }

}

package android.telephony.ims {

  public final class ImsCallForwardInfo implements android.os.Parcelable {
    ctor public ImsCallForwardInfo(int, int, int, int, @NonNull String, int);
    method public int describeContents();
    method public int getCondition();
    method public String getNumber();
    method public int getServiceClass();
    method public int getStatus();
    method public int getTimeSeconds();
    method public int getToA();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CDIV_CF_REASON_ALL = 4; // 0x4
    field public static final int CDIV_CF_REASON_ALL_CONDITIONAL = 5; // 0x5
    field public static final int CDIV_CF_REASON_BUSY = 1; // 0x1
    field public static final int CDIV_CF_REASON_NOT_LOGGED_IN = 6; // 0x6
    field public static final int CDIV_CF_REASON_NOT_REACHABLE = 3; // 0x3
    field public static final int CDIV_CF_REASON_NO_REPLY = 2; // 0x2
    field public static final int CDIV_CF_REASON_UNCONDITIONAL = 0; // 0x0
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR;
    field public static final int STATUS_ACTIVE = 1; // 0x1
    field public static final int STATUS_NOT_ACTIVE = 0; // 0x0
    field public static final int TYPE_OF_ADDRESS_INTERNATIONAL = 145; // 0x91
    field public static final int TYPE_OF_ADDRESS_UNKNOWN = 129; // 0x81
  }

  public final class ImsCallProfile implements android.os.Parcelable {
    ctor public ImsCallProfile();
    ctor public ImsCallProfile(int, int);
    ctor public ImsCallProfile(int, int, android.os.Bundle, android.telephony.ims.ImsStreamMediaProfile);
    method public int describeContents();
    method public String getCallExtra(String);
    method public String getCallExtra(String, String);
    method public boolean getCallExtraBoolean(String);
    method public boolean getCallExtraBoolean(String, boolean);
    method public int getCallExtraInt(String);
    method public int getCallExtraInt(String, int);
    method public android.os.Bundle getCallExtras();
    method public int getCallType();
    method public static int getCallTypeFromVideoState(int);
    method public int getCallerNumberVerificationStatus();
    method public int getEmergencyCallRouting();
    method public int getEmergencyServiceCategories();
    method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
    method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
    method @Nullable public android.os.Bundle getProprietaryCallExtras();
    method public int getRestrictCause();
    method public int getServiceType();
    method public static int getVideoStateFromCallType(int);
    method public static int getVideoStateFromImsCallProfile(android.telephony.ims.ImsCallProfile);
    method public boolean hasKnownUserIntentEmergency();
    method public boolean isEmergencyCallTesting();
    method public boolean isVideoCall();
    method public boolean isVideoPaused();
    method public static int presentationToOir(int);
    method public void setCallExtra(String, String);
    method public void setCallExtraBoolean(String, boolean);
    method public void setCallExtraInt(String, int);
    method public void setCallRestrictCause(int);
    method public void setCallerNumberVerificationStatus(int);
    method public void setEmergencyCallRouting(int);
    method public void setEmergencyCallTesting(boolean);
    method public void setEmergencyServiceCategories(int);
    method public void setEmergencyUrns(@NonNull java.util.List<java.lang.String>);
    method public void setHasKnownUserIntentEmergency(boolean);
    method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
    method public void updateCallType(android.telephony.ims.ImsCallProfile);
    method public void updateMediaProfile(android.telephony.ims.ImsCallProfile);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; // 0x2
    field public static final int CALL_RESTRICT_CAUSE_HD = 3; // 0x3
    field public static final int CALL_RESTRICT_CAUSE_NONE = 0; // 0x0
    field public static final int CALL_RESTRICT_CAUSE_RAT = 1; // 0x1
    field public static final int CALL_TYPE_VIDEO_N_VOICE = 3; // 0x3
    field public static final int CALL_TYPE_VOICE = 2; // 0x2
    field public static final int CALL_TYPE_VOICE_N_VIDEO = 1; // 0x1
    field public static final int CALL_TYPE_VS = 8; // 0x8
    field public static final int CALL_TYPE_VS_RX = 10; // 0xa
    field public static final int CALL_TYPE_VS_TX = 9; // 0x9
    field public static final int CALL_TYPE_VT = 4; // 0x4
    field public static final int CALL_TYPE_VT_NODIR = 7; // 0x7
    field public static final int CALL_TYPE_VT_RX = 6; // 0x6
    field public static final int CALL_TYPE_VT_TX = 5; // 0x5
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallProfile> CREATOR;
    field public static final int DIALSTRING_NORMAL = 0; // 0x0
    field public static final int DIALSTRING_SS_CONF = 1; // 0x1
    field public static final int DIALSTRING_USSD = 2; // 0x2
    field public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo";
    field public static final String EXTRA_ADDITIONAL_SIP_INVITE_FIELDS = "android.telephony.ims.extra.ADDITIONAL_SIP_INVITE_FIELDS";
    field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telephony.ims.extra.CALL_DISCONNECT_CAUSE";
    field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telephony.ims.extra.CALL_NETWORK_TYPE";
    field @Deprecated public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final String EXTRA_CHILD_NUMBER = "ChildNum";
    field public static final String EXTRA_CNA = "cna";
    field public static final String EXTRA_CNAP = "cnap";
    field public static final String EXTRA_CODEC = "Codec";
    field public static final String EXTRA_DIALSTRING = "dialstring";
    field public static final String EXTRA_DISPLAY_TEXT = "DisplayText";
    field public static final String EXTRA_EMERGENCY_CALL = "e_call";
    field public static final String EXTRA_FORWARDED_NUMBER = "android.telephony.ims.extra.FORWARDED_NUMBER";
    field public static final String EXTRA_IS_CALL_PULL = "CallPull";
    field public static final String EXTRA_OEM_EXTRAS = "android.telephony.ims.extra.OEM_EXTRAS";
    field public static final String EXTRA_OI = "oi";
    field public static final String EXTRA_OIR = "oir";
    field public static final String EXTRA_REMOTE_URI = "remote_uri";
    field public static final String EXTRA_USSD = "ussd";
    field public static final int OIR_DEFAULT = 0; // 0x0
    field public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; // 0x2
    field public static final int OIR_PRESENTATION_PAYPHONE = 4; // 0x4
    field public static final int OIR_PRESENTATION_RESTRICTED = 1; // 0x1
    field public static final int OIR_PRESENTATION_UNKNOWN = 3; // 0x3
    field public static final int SERVICE_TYPE_EMERGENCY = 2; // 0x2
    field public static final int SERVICE_TYPE_NONE = 0; // 0x0
    field public static final int SERVICE_TYPE_NORMAL = 1; // 0x1
    field public static final int VERIFICATION_STATUS_FAILED = 2; // 0x2
    field public static final int VERIFICATION_STATUS_NOT_VERIFIED = 0; // 0x0
    field public static final int VERIFICATION_STATUS_PASSED = 1; // 0x1
  }

  public class ImsCallSessionListener {
    method public void callQualityChanged(@NonNull android.telephony.CallQuality);
    method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionConferenceStateUpdated(android.telephony.ims.ImsConferenceState);
    method @Deprecated public void callSessionHandover(int, int, android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionHandoverFailed(int, int, android.telephony.ims.ImsReasonInfo);
    method public void callSessionHeld(android.telephony.ims.ImsCallProfile);
    method public void callSessionHoldFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionHoldReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionInitiated(android.telephony.ims.ImsCallProfile);
    method public void callSessionInitiatedFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionInviteParticipantsRequestDelivered();
    method public void callSessionInviteParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo);
    method @Deprecated public void callSessionMayHandover(int, int);
    method public void callSessionMergeComplete(android.telephony.ims.stub.ImsCallSessionImplBase);
    method public void callSessionMergeFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionMergeStarted(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
    method public void callSessionMultipartyStateChanged(boolean);
    method public void callSessionProgressing(android.telephony.ims.ImsStreamMediaProfile);
    method public void callSessionRemoveParticipantsRequestDelivered();
    method public void callSessionRemoveParticipantsRequestFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionResumeFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionResumeReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionResumed(android.telephony.ims.ImsCallProfile);
    method public void callSessionRttAudioIndicatorChanged(@NonNull android.telephony.ims.ImsStreamMediaProfile);
    method public void callSessionRttMessageReceived(String);
    method public void callSessionRttModifyRequestReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionRttModifyResponseReceived(int);
    method public void callSessionSuppServiceReceived(android.telephony.ims.ImsSuppServiceNotification);
    method public void callSessionTerminated(android.telephony.ims.ImsReasonInfo);
    method public void callSessionTtyModeReceived(int);
    method public void callSessionUpdateFailed(android.telephony.ims.ImsReasonInfo);
    method public void callSessionUpdateReceived(android.telephony.ims.ImsCallProfile);
    method public void callSessionUpdated(android.telephony.ims.ImsCallProfile);
    method public void callSessionUssdMessageReceived(int, String);
    method public void onHandover(int, int, @Nullable android.telephony.ims.ImsReasonInfo);
    method public void onHandoverFailed(int, int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void onMayHandover(int, int);
  }

  public final class ImsConferenceState implements android.os.Parcelable {
    method public int describeContents();
    method public static int getConnectionStateForStatus(String);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsConferenceState> CREATOR;
    field public static final String DISPLAY_TEXT = "display-text";
    field public static final String ENDPOINT = "endpoint";
    field public static final String SIP_STATUS_CODE = "sipstatuscode";
    field public static final String STATUS = "status";
    field public static final String STATUS_ALERTING = "alerting";
    field public static final String STATUS_CONNECTED = "connected";
    field public static final String STATUS_CONNECT_FAIL = "connect-fail";
    field public static final String STATUS_DIALING_IN = "dialing-in";
    field public static final String STATUS_DIALING_OUT = "dialing-out";
    field public static final String STATUS_DISCONNECTED = "disconnected";
    field public static final String STATUS_DISCONNECTING = "disconnecting";
    field public static final String STATUS_MUTED_VIA_FOCUS = "muted-via-focus";
    field public static final String STATUS_ON_HOLD = "on-hold";
    field public static final String STATUS_PENDING = "pending";
    field public static final String STATUS_SEND_ONLY = "sendonly";
    field public static final String STATUS_SEND_RECV = "sendrecv";
    field public static final String USER = "user";
    field public final java.util.HashMap<java.lang.String,android.os.Bundle> mParticipants;
  }

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

  public final class ImsExternalCallState implements android.os.Parcelable {
    ctor public ImsExternalCallState(@NonNull String, @NonNull android.net.Uri, @Nullable android.net.Uri, boolean, int, int, boolean);
    method public int describeContents();
    method @NonNull public android.net.Uri getAddress();
    method public int getCallId();
    method public int getCallState();
    method public int getCallType();
    method @Nullable public android.net.Uri getLocalAddress();
    method public boolean isCallHeld();
    method public boolean isCallPullable();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALL_STATE_CONFIRMED = 1; // 0x1
    field public static final int CALL_STATE_TERMINATED = 2; // 0x2
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR;
  }

  public class ImsManager {
    method @NonNull public android.telephony.ims.ImsRcsManager getImsRcsManager(int);
    field public static final String ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION = "com.android.internal.intent.action.ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION";
  }

  public class ImsMmTelManager implements android.telephony.ims.RegistrationManager {
    method @Deprecated @NonNull @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getFeatureState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>) throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getVoWiFiRoamingModeSetting();
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isAvailable(int, int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isCapable(int, int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void isSupported(int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>) throws android.telephony.ims.ImsException;
    method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException;
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiModeSetting(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiNonPersistent(boolean, int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingModeSetting(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSettingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiSettingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVtSettingEnabled(boolean);
    method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback);
  }

  @Deprecated public static class ImsMmTelManager.RegistrationCallback extends android.telephony.ims.RegistrationManager.RegistrationCallback {
    ctor @Deprecated public ImsMmTelManager.RegistrationCallback();
  }

  public class ImsRcsManager implements android.telephony.ims.RegistrationManager {
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isAvailable(int) throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isCapable(int, int) throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerRcsAvailabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsRcsManager.AvailabilityCallback) throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterRcsAvailabilityCallback(@NonNull android.telephony.ims.ImsRcsManager.AvailabilityCallback) throws android.telephony.ims.ImsException;
  }

  public static class ImsRcsManager.AvailabilityCallback {
    ctor public ImsRcsManager.AvailabilityCallback();
    method public void onAvailabilityChanged(@NonNull android.telephony.ims.feature.RcsFeature.RcsImsCapabilities);
  }

  public class ImsService extends android.app.Service {
    ctor public ImsService();
    method public android.telephony.ims.feature.MmTelFeature createMmTelFeature(int);
    method public android.telephony.ims.feature.RcsFeature createRcsFeature(int);
    method public void disableIms(int);
    method public void enableIms(int);
    method public android.telephony.ims.stub.ImsConfigImplBase getConfig(int);
    method public android.telephony.ims.stub.ImsRegistrationImplBase getRegistration(int);
    method public final void onUpdateSupportedImsFeatures(android.telephony.ims.stub.ImsFeatureConfiguration) throws android.os.RemoteException;
    method public android.telephony.ims.stub.ImsFeatureConfiguration querySupportedImsFeatures();
    method public void readyForFeatureCreation();
  }

  public final class ImsSsData implements android.os.Parcelable {
    ctor public ImsSsData(int, int, int, int, int);
    method public int describeContents();
    method @Nullable public java.util.List<android.telephony.ims.ImsCallForwardInfo> getCallForwardInfo();
    method public int getRequestType();
    method public int getResult();
    method public int getServiceClass();
    method public int getServiceType();
    method @NonNull public java.util.List<android.telephony.ims.ImsSsInfo> getSuppServiceInfo();
    method public int getTeleserviceType();
    method public boolean isTypeBarring();
    method public boolean isTypeCf();
    method public boolean isTypeClip();
    method public boolean isTypeClir();
    method public boolean isTypeColp();
    method public boolean isTypeColr();
    method public boolean isTypeCw();
    method public boolean isTypeIcb();
    method public boolean isTypeInterrogation();
    method public boolean isTypeUnConditional();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR;
    field public static final int RESULT_SUCCESS = 0; // 0x0
    field public static final int SERVICE_CLASS_DATA = 2; // 0x2
    field public static final int SERVICE_CLASS_DATA_CIRCUIT_ASYNC = 32; // 0x20
    field public static final int SERVICE_CLASS_DATA_CIRCUIT_SYNC = 16; // 0x10
    field public static final int SERVICE_CLASS_DATA_PACKET_ACCESS = 64; // 0x40
    field public static final int SERVICE_CLASS_DATA_PAD = 128; // 0x80
    field public static final int SERVICE_CLASS_FAX = 4; // 0x4
    field public static final int SERVICE_CLASS_NONE = 0; // 0x0
    field public static final int SERVICE_CLASS_SMS = 8; // 0x8
    field public static final int SERVICE_CLASS_VOICE = 1; // 0x1
    field public static final int SS_ACTIVATION = 0; // 0x0
    field public static final int SS_ALL_BARRING = 18; // 0x12
    field public static final int SS_ALL_DATA_TELESERVICES = 3; // 0x3
    field public static final int SS_ALL_TELESERVICES_EXCEPT_SMS = 5; // 0x5
    field public static final int SS_ALL_TELESEVICES = 1; // 0x1
    field public static final int SS_ALL_TELE_AND_BEARER_SERVICES = 0; // 0x0
    field public static final int SS_BAIC = 16; // 0x10
    field public static final int SS_BAIC_ROAMING = 17; // 0x11
    field public static final int SS_BAOC = 13; // 0xd
    field public static final int SS_BAOIC = 14; // 0xe
    field public static final int SS_BAOIC_EXC_HOME = 15; // 0xf
    field public static final int SS_CFU = 0; // 0x0
    field public static final int SS_CFUT = 6; // 0x6
    field public static final int SS_CF_ALL = 4; // 0x4
    field public static final int SS_CF_ALL_CONDITIONAL = 5; // 0x5
    field public static final int SS_CF_BUSY = 1; // 0x1
    field public static final int SS_CF_NOT_REACHABLE = 3; // 0x3
    field public static final int SS_CF_NO_REPLY = 2; // 0x2
    field public static final int SS_CLIP = 7; // 0x7
    field public static final int SS_CLIR = 8; // 0x8
    field public static final int SS_CNAP = 11; // 0xb
    field public static final int SS_COLP = 9; // 0x9
    field public static final int SS_COLR = 10; // 0xa
    field public static final int SS_DEACTIVATION = 1; // 0x1
    field public static final int SS_ERASURE = 4; // 0x4
    field public static final int SS_INCOMING_BARRING = 20; // 0x14
    field public static final int SS_INCOMING_BARRING_ANONYMOUS = 22; // 0x16
    field public static final int SS_INCOMING_BARRING_DN = 21; // 0x15
    field public static final int SS_INTERROGATION = 2; // 0x2
    field public static final int SS_OUTGOING_BARRING = 19; // 0x13
    field public static final int SS_REGISTRATION = 3; // 0x3
    field public static final int SS_SMS_SERVICES = 4; // 0x4
    field public static final int SS_TELEPHONY = 2; // 0x2
    field public static final int SS_WAIT = 12; // 0xc
  }

  public static final class ImsSsData.Builder {
    ctor public ImsSsData.Builder(int, int, int, int, int);
    method @NonNull public android.telephony.ims.ImsSsData build();
    method @NonNull public android.telephony.ims.ImsSsData.Builder setCallForwardingInfo(@NonNull java.util.List<android.telephony.ims.ImsCallForwardInfo>);
    method @NonNull public android.telephony.ims.ImsSsData.Builder setSuppServiceInfo(@NonNull java.util.List<android.telephony.ims.ImsSsInfo>);
  }

  public final class ImsSsInfo implements android.os.Parcelable {
    ctor @Deprecated public ImsSsInfo(int, @Nullable String);
    method public int describeContents();
    method public int getClirInterrogationStatus();
    method public int getClirOutgoingState();
    method @Deprecated public String getIcbNum();
    method @Nullable public String getIncomingCommunicationBarringNumber();
    method public int getProvisionStatus();
    method public int getStatus();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CLIR_OUTGOING_DEFAULT = 0; // 0x0
    field public static final int CLIR_OUTGOING_INVOCATION = 1; // 0x1
    field public static final int CLIR_OUTGOING_SUPPRESSION = 2; // 0x2
    field public static final int CLIR_STATUS_NOT_PROVISIONED = 0; // 0x0
    field public static final int CLIR_STATUS_PROVISIONED_PERMANENT = 1; // 0x1
    field public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4; // 0x4
    field public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3; // 0x3
    field public static final int CLIR_STATUS_UNKNOWN = 2; // 0x2
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR;
    field public static final int DISABLED = 0; // 0x0
    field public static final int ENABLED = 1; // 0x1
    field public static final int NOT_REGISTERED = -1; // 0xffffffff
    field public static final int SERVICE_NOT_PROVISIONED = 0; // 0x0
    field public static final int SERVICE_PROVISIONED = 1; // 0x1
    field public static final int SERVICE_PROVISIONING_UNKNOWN = -1; // 0xffffffff
  }

  public static final class ImsSsInfo.Builder {
    ctor public ImsSsInfo.Builder(int);
    method @NonNull public android.telephony.ims.ImsSsInfo build();
    method @NonNull public android.telephony.ims.ImsSsInfo.Builder setClirInterrogationStatus(int);
    method @NonNull public android.telephony.ims.ImsSsInfo.Builder setClirOutgoingState(int);
    method @NonNull public android.telephony.ims.ImsSsInfo.Builder setIncomingCommunicationBarringNumber(@NonNull String);
    method @NonNull public android.telephony.ims.ImsSsInfo.Builder setProvisionStatus(int);
  }

  public final class ImsStreamMediaProfile implements android.os.Parcelable {
    ctor public ImsStreamMediaProfile(int, int, int, int, int);
    method public void copyFrom(android.telephony.ims.ImsStreamMediaProfile);
    method public int describeContents();
    method public int getAudioDirection();
    method public int getAudioQuality();
    method public int getRttMode();
    method public int getVideoDirection();
    method public int getVideoQuality();
    method public boolean isReceivingRttAudio();
    method public boolean isRttCall();
    method public void setReceivingRttAudio(boolean);
    method public void setRttMode(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int AUDIO_QUALITY_AMR = 1; // 0x1
    field public static final int AUDIO_QUALITY_AMR_WB = 2; // 0x2
    field public static final int AUDIO_QUALITY_EVRC = 4; // 0x4
    field public static final int AUDIO_QUALITY_EVRC_B = 5; // 0x5
    field public static final int AUDIO_QUALITY_EVRC_NW = 7; // 0x7
    field public static final int AUDIO_QUALITY_EVRC_WB = 6; // 0x6
    field public static final int AUDIO_QUALITY_EVS_FB = 20; // 0x14
    field public static final int AUDIO_QUALITY_EVS_NB = 17; // 0x11
    field public static final int AUDIO_QUALITY_EVS_SWB = 19; // 0x13
    field public static final int AUDIO_QUALITY_EVS_WB = 18; // 0x12
    field public static final int AUDIO_QUALITY_G711A = 13; // 0xd
    field public static final int AUDIO_QUALITY_G711AB = 15; // 0xf
    field public static final int AUDIO_QUALITY_G711U = 11; // 0xb
    field public static final int AUDIO_QUALITY_G722 = 14; // 0xe
    field public static final int AUDIO_QUALITY_G723 = 12; // 0xc
    field public static final int AUDIO_QUALITY_G729 = 16; // 0x10
    field public static final int AUDIO_QUALITY_GSM_EFR = 8; // 0x8
    field public static final int AUDIO_QUALITY_GSM_FR = 9; // 0x9
    field public static final int AUDIO_QUALITY_GSM_HR = 10; // 0xa
    field public static final int AUDIO_QUALITY_NONE = 0; // 0x0
    field public static final int AUDIO_QUALITY_QCELP13K = 3; // 0x3
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsStreamMediaProfile> CREATOR;
    field public static final int DIRECTION_INACTIVE = 0; // 0x0
    field public static final int DIRECTION_INVALID = -1; // 0xffffffff
    field public static final int DIRECTION_RECEIVE = 1; // 0x1
    field public static final int DIRECTION_SEND = 2; // 0x2
    field public static final int DIRECTION_SEND_RECEIVE = 3; // 0x3
    field public static final int RTT_MODE_DISABLED = 0; // 0x0
    field public static final int RTT_MODE_FULL = 1; // 0x1
    field public static final int VIDEO_QUALITY_NONE = 0; // 0x0
    field public static final int VIDEO_QUALITY_QCIF = 1; // 0x1
    field public static final int VIDEO_QUALITY_QVGA_LANDSCAPE = 2; // 0x2
    field public static final int VIDEO_QUALITY_QVGA_PORTRAIT = 4; // 0x4
    field public static final int VIDEO_QUALITY_VGA_LANDSCAPE = 8; // 0x8
    field public static final int VIDEO_QUALITY_VGA_PORTRAIT = 16; // 0x10
  }

  public final class ImsSuppServiceNotification implements android.os.Parcelable {
    ctor public ImsSuppServiceNotification(int, int, int, int, String, String[]);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSuppServiceNotification> CREATOR;
    field public final int code;
    field public final String[] history;
    field public final int index;
    field public final int notificationType;
    field public final String number;
    field public final int type;
  }

  public class ImsUtListener {
    method public void onLineIdentificationSupplementaryServiceResponse(int, @NonNull android.telephony.ims.ImsSsInfo);
    method public void onSupplementaryServiceIndication(android.telephony.ims.ImsSsData);
    method public void onUtConfigurationCallBarringQueried(int, android.telephony.ims.ImsSsInfo[]);
    method public void onUtConfigurationCallForwardQueried(int, android.telephony.ims.ImsCallForwardInfo[]);
    method public void onUtConfigurationCallWaitingQueried(int, android.telephony.ims.ImsSsInfo[]);
    method @Deprecated public void onUtConfigurationQueried(int, android.os.Bundle);
    method public void onUtConfigurationQueryFailed(int, android.telephony.ims.ImsReasonInfo);
    method public void onUtConfigurationUpdateFailed(int, android.telephony.ims.ImsReasonInfo);
    method public void onUtConfigurationUpdated(int);
    field @Deprecated public static final String BUNDLE_KEY_CLIR = "queryClir";
    field @Deprecated public static final String BUNDLE_KEY_SSINFO = "imsSsInfo";
  }

  public abstract class ImsVideoCallProvider {
    ctor public ImsVideoCallProvider();
    method public void changeCallDataUsage(long);
    method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
    method public void changePeerDimensions(int, int);
    method public void changeVideoQuality(int);
    method public void handleCallSessionEvent(int);
    method public abstract void onRequestCallDataUsage();
    method public abstract void onRequestCameraCapabilities();
    method public abstract void onSendSessionModifyRequest(android.telecom.VideoProfile, android.telecom.VideoProfile);
    method public abstract void onSendSessionModifyResponse(android.telecom.VideoProfile);
    method public abstract void onSetCamera(String);
    method public void onSetCamera(String, int);
    method public abstract void onSetDeviceOrientation(int);
    method public abstract void onSetDisplaySurface(android.view.Surface);
    method public abstract void onSetPauseImage(android.net.Uri);
    method public abstract void onSetPreviewSurface(android.view.Surface);
    method public abstract void onSetZoom(float);
    method public void receiveSessionModifyRequest(android.telecom.VideoProfile);
    method public void receiveSessionModifyResponse(int, android.telecom.VideoProfile, android.telecom.VideoProfile);
  }

  public class ProvisioningManager {
    method @NonNull public static android.telephony.ims.ProvisioningManager createForSubscriptionId(int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @WorkerThread public int getProvisioningIntValue(int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @WorkerThread public boolean getProvisioningStatusForCapability(int, int);
    method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @WorkerThread public String getProvisioningStringValue(int);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @WorkerThread public boolean getRcsProvisioningStatusForCapability(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException;
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setProvisioningStatusForCapability(int, int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setRcsProvisioningStatusForCapability(int, boolean);
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback);
    field public static final int KEY_1X_EPDG_TIMER_SEC = 64; // 0x40
    field public static final int KEY_1X_THRESHOLD = 59; // 0x3b
    field public static final int KEY_AMR_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 50; // 0x32
    field public static final int KEY_AMR_CODEC_MODE_SET_VALUES = 0; // 0x0
    field public static final int KEY_AMR_DEFAULT_ENCODING_MODE = 53; // 0x35
    field public static final int KEY_AMR_OCTET_ALIGNED_PAYLOAD_TYPE = 49; // 0x31
    field public static final int KEY_AMR_WB_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 48; // 0x30
    field public static final int KEY_AMR_WB_CODEC_MODE_SET_VALUES = 1; // 0x1
    field public static final int KEY_AMR_WB_OCTET_ALIGNED_PAYLOAD_TYPE = 47; // 0x2f
    field public static final int KEY_DTMF_NB_PAYLOAD_TYPE = 52; // 0x34
    field public static final int KEY_DTMF_WB_PAYLOAD_TYPE = 51; // 0x33
    field public static final int KEY_EAB_PROVISIONING_STATUS = 25; // 0x19
    field public static final int KEY_ENABLE_SILENT_REDIAL = 6; // 0x6
    field public static final int KEY_LOCAL_BREAKOUT_PCSCF_ADDRESS = 31; // 0x1f
    field public static final int KEY_LTE_EPDG_TIMER_SEC = 62; // 0x3e
    field public static final int KEY_LTE_THRESHOLD_1 = 56; // 0x38
    field public static final int KEY_LTE_THRESHOLD_2 = 57; // 0x39
    field public static final int KEY_LTE_THRESHOLD_3 = 58; // 0x3a
    field public static final int KEY_MINIMUM_SIP_SESSION_EXPIRATION_TIMER_SEC = 3; // 0x3
    field public static final int KEY_MOBILE_DATA_ENABLED = 29; // 0x1d
    field public static final int KEY_MULTIENDPOINT_ENABLED = 65; // 0x41
    field public static final int KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC = 19; // 0x13
    field public static final int KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC = 18; // 0x12
    field public static final int KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC = 20; // 0x14
    field public static final int KEY_RCS_CAPABILITY_DISCOVERY_ENABLED = 17; // 0x11
    field public static final int KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC = 23; // 0x17
    field public static final int KEY_RCS_MAX_NUM_ENTRIES_IN_RCL = 22; // 0x16
    field public static final int KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS = 21; // 0x15
    field public static final int KEY_RCS_PUBLISH_TIMER_EXTENDED_SEC = 16; // 0x10
    field public static final int KEY_RCS_PUBLISH_TIMER_SEC = 15; // 0xf
    field public static final int KEY_REGISTRATION_DOMAIN_NAME = 12; // 0xc
    field public static final int KEY_REGISTRATION_RETRY_BASE_TIME_SEC = 33; // 0x21
    field public static final int KEY_REGISTRATION_RETRY_MAX_TIME_SEC = 34; // 0x22
    field public static final int KEY_RTP_SPEECH_END_PORT = 36; // 0x24
    field public static final int KEY_RTP_SPEECH_START_PORT = 35; // 0x23
    field public static final int KEY_RTT_ENABLED = 66; // 0x42
    field public static final int KEY_SIP_ACK_RECEIPT_WAIT_TIME_MS = 43; // 0x2b
    field public static final int KEY_SIP_ACK_RETRANSMIT_WAIT_TIME_MS = 44; // 0x2c
    field public static final int KEY_SIP_INVITE_ACK_WAIT_TIME_MS = 38; // 0x26
    field public static final int KEY_SIP_INVITE_CANCELLATION_TIMER_MS = 4; // 0x4
    field public static final int KEY_SIP_INVITE_REQUEST_TRANSMIT_INTERVAL_MS = 37; // 0x25
    field public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_INTERVAL_MS = 42; // 0x2a
    field public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_WAIT_TIME_MS = 39; // 0x27
    field public static final int KEY_SIP_KEEP_ALIVE_ENABLED = 32; // 0x20
    field public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMISSION_WAIT_TIME_MS = 45; // 0x2d
    field public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMIT_INTERVAL_MS = 40; // 0x28
    field public static final int KEY_SIP_NON_INVITE_RESPONSE_RETRANSMISSION_WAIT_TIME_MS = 46; // 0x2e
    field public static final int KEY_SIP_NON_INVITE_TRANSACTION_TIMEOUT_TIMER_MS = 41; // 0x29
    field public static final int KEY_SIP_SESSION_TIMER_SEC = 2; // 0x2
    field public static final int KEY_SMS_FORMAT = 13; // 0xd
    field public static final int KEY_SMS_OVER_IP_ENABLED = 14; // 0xe
    field public static final int KEY_SMS_PUBLIC_SERVICE_IDENTITY = 54; // 0x36
    field public static final int KEY_T1_TIMER_VALUE_MS = 7; // 0x7
    field public static final int KEY_T2_TIMER_VALUE_MS = 8; // 0x8
    field public static final int KEY_TF_TIMER_VALUE_MS = 9; // 0x9
    field public static final int KEY_TRANSITION_TO_LTE_DELAY_MS = 5; // 0x5
    field public static final int KEY_USE_GZIP_FOR_LIST_SUBSCRIPTION = 24; // 0x18
    field public static final int KEY_VIDEO_QUALITY = 55; // 0x37
    field public static final int KEY_VOICE_OVER_WIFI_ENABLED_OVERRIDE = 28; // 0x1c
    field public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; // 0x1b
    field public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; // 0x1a
    field public static final int KEY_VOLTE_PROVISIONING_STATUS = 10; // 0xa
    field public static final int KEY_VOLTE_USER_OPT_IN_STATUS = 30; // 0x1e
    field public static final int KEY_VT_PROVISIONING_STATUS = 11; // 0xb
    field public static final int KEY_WIFI_EPDG_TIMER_SEC = 63; // 0x3f
    field public static final int KEY_WIFI_THRESHOLD_A = 60; // 0x3c
    field public static final int KEY_WIFI_THRESHOLD_B = 61; // 0x3d
    field public static final int PROVISIONING_RESULT_UNKNOWN = -1; // 0xffffffff
    field public static final int PROVISIONING_VALUE_DISABLED = 0; // 0x0
    field public static final int PROVISIONING_VALUE_ENABLED = 1; // 0x1
    field public static final int SMS_FORMAT_3GPP = 1; // 0x1
    field public static final int SMS_FORMAT_3GPP2 = 0; // 0x0
    field public static final String STRING_QUERY_RESULT_ERROR_GENERIC = "STRING_QUERY_RESULT_ERROR_GENERIC";
    field public static final String STRING_QUERY_RESULT_ERROR_NOT_READY = "STRING_QUERY_RESULT_ERROR_NOT_READY";
    field public static final int VIDEO_QUALITY_HIGH = 1; // 0x1
    field public static final int VIDEO_QUALITY_LOW = 0; // 0x0
  }

  public static class ProvisioningManager.Callback {
    ctor public ProvisioningManager.Callback();
    method public void onProvisioningIntChanged(int, int);
    method public void onProvisioningStringChanged(int, @NonNull String);
  }

  public final class RcsContactUceCapability implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<java.lang.String> getCapableExtensionTags();
    method @NonNull public android.net.Uri getContactUri();
    method @Nullable public android.net.Uri getServiceUri(long);
    method public boolean isCapable(long);
    method public boolean isCapable(@NonNull String);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int CAPABILITY_CALL_COMPOSER = 4194304; // 0x400000
    field public static final int CAPABILITY_CHAT_BOT = 67108864; // 0x4000000
    field public static final int CAPABILITY_CHAT_BOT_ROLE = 134217728; // 0x8000000
    field public static final int CAPABILITY_CHAT_SESSION = 2; // 0x2
    field public static final int CAPABILITY_CHAT_SESSION_STORE_FORWARD = 4; // 0x4
    field public static final int CAPABILITY_CHAT_STANDALONE = 1; // 0x1
    field public static final int CAPABILITY_DISCOVERY_VIA_PRESENCE = 4096; // 0x1000
    field public static final int CAPABILITY_FILE_TRANSFER = 8; // 0x8
    field public static final int CAPABILITY_FILE_TRANSFER_HTTP = 64; // 0x40
    field public static final int CAPABILITY_FILE_TRANSFER_SMS = 128; // 0x80
    field public static final int CAPABILITY_FILE_TRANSFER_STORE_FORWARD = 32; // 0x20
    field public static final int CAPABILITY_FILE_TRANSFER_THUMBNAIL = 16; // 0x10
    field public static final int CAPABILITY_GEOLOCATION_PULL = 131072; // 0x20000
    field public static final int CAPABILITY_GEOLOCATION_PULL_FILE_TRANSFER = 262144; // 0x40000
    field public static final int CAPABILITY_GEOLOCATION_PUSH = 32768; // 0x8000
    field public static final int CAPABILITY_GEOLOCATION_PUSH_SMS = 65536; // 0x10000
    field public static final int CAPABILITY_IMAGE_SHARE = 256; // 0x100
    field public static final int CAPABILITY_IP_VIDEO_CALL = 16384; // 0x4000
    field public static final int CAPABILITY_IP_VOICE_CALL = 8192; // 0x2000
    field public static final int CAPABILITY_MMTEL_CALL_COMPOSER = 1073741824; // 0x40000000
    field public static final int CAPABILITY_PLUG_IN = 268435456; // 0x10000000
    field public static final int CAPABILITY_POST_CALL = 8388608; // 0x800000
    field public static final int CAPABILITY_RCS_VIDEO_CALL = 1048576; // 0x100000
    field public static final int CAPABILITY_RCS_VIDEO_ONLY_CALL = 2097152; // 0x200000
    field public static final int CAPABILITY_RCS_VOICE_CALL = 524288; // 0x80000
    field public static final int CAPABILITY_SHARED_MAP = 16777216; // 0x1000000
    field public static final int CAPABILITY_SHARED_SKETCH = 33554432; // 0x2000000
    field public static final int CAPABILITY_SOCIAL_PRESENCE = 2048; // 0x800
    field public static final int CAPABILITY_STANDALONE_CHAT_BOT = 536870912; // 0x20000000
    field public static final int CAPABILITY_VIDEO_SHARE = 1024; // 0x400
    field public static final int CAPABILITY_VIDEO_SHARE_DURING_CS_CALL = 512; // 0x200
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.RcsContactUceCapability> CREATOR;
  }

  public static class RcsContactUceCapability.Builder {
    ctor public RcsContactUceCapability.Builder(@NonNull android.net.Uri);
    method @NonNull public android.telephony.ims.RcsContactUceCapability.Builder add(long, @NonNull android.net.Uri);
    method @NonNull public android.telephony.ims.RcsContactUceCapability.Builder add(long);
    method @NonNull public android.telephony.ims.RcsContactUceCapability.Builder add(@NonNull String);
    method @NonNull public android.telephony.ims.RcsContactUceCapability build();
  }

  public class RcsUceAdapter {
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getUcePublishState() throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException;
    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void requestCapabilities(@NonNull java.util.concurrent.Executor, @NonNull java.util.List<android.net.Uri>, @NonNull android.telephony.ims.RcsUceAdapter.CapabilitiesCallback) throws android.telephony.ims.ImsException;
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException;
    field public static final int ERROR_ALREADY_IN_QUEUE = 13; // 0xd
    field public static final int ERROR_FORBIDDEN = 6; // 0x6
    field public static final int ERROR_GENERIC_FAILURE = 1; // 0x1
    field public static final int ERROR_INSUFFICIENT_MEMORY = 11; // 0xb
    field public static final int ERROR_LOST_NETWORK = 12; // 0xc
    field public static final int ERROR_NOT_AUTHORIZED = 5; // 0x5
    field public static final int ERROR_NOT_AVAILABLE = 3; // 0x3
    field public static final int ERROR_NOT_ENABLED = 2; // 0x2
    field public static final int ERROR_NOT_FOUND = 7; // 0x7
    field public static final int ERROR_NOT_REGISTERED = 4; // 0x4
    field public static final int ERROR_REQUEST_TIMEOUT = 10; // 0xa
    field public static final int ERROR_REQUEST_TOO_LARGE = 8; // 0x8
    field public static final int PUBLISH_STATE_200_OK = 1; // 0x1
    field public static final int PUBLISH_STATE_NOT_PUBLISHED = 2; // 0x2
    field public static final int PUBLISH_STATE_OTHER_ERROR = 6; // 0x6
    field public static final int PUBLISH_STATE_RCS_PROVISION_ERROR = 4; // 0x4
    field public static final int PUBLISH_STATE_REQUEST_TIMEOUT = 5; // 0x5
    field public static final int PUBLISH_STATE_VOLTE_PROVISION_ERROR = 3; // 0x3
  }

  public static class RcsUceAdapter.CapabilitiesCallback {
    ctor public RcsUceAdapter.CapabilitiesCallback();
    method public void onCapabilitiesReceived(@NonNull java.util.List<android.telephony.ims.RcsContactUceCapability>);
    method public void onError(int);
  }

}

package android.telephony.ims.feature {

  public final class CapabilityChangeRequest implements android.os.Parcelable {
    method public void addCapabilitiesToDisableForTech(int, int);
    method public void addCapabilitiesToEnableForTech(int, int);
    method public int describeContents();
    method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToDisable();
    method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToEnable();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.feature.CapabilityChangeRequest> CREATOR;
  }

  public static class CapabilityChangeRequest.CapabilityPair {
    ctor public CapabilityChangeRequest.CapabilityPair(int, int);
    method public int getCapability();
    method public int getRadioTech();
  }

  public abstract class ImsFeature {
    ctor public ImsFeature();
    method public abstract void changeEnabledCapabilities(android.telephony.ims.feature.CapabilityChangeRequest, android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
    method public int getFeatureState();
    method public final int getSlotIndex();
    method public abstract void onFeatureReady();
    method public abstract void onFeatureRemoved();
    method public final void setFeatureState(int);
    field public static final int CAPABILITY_ERROR_GENERIC = -1; // 0xffffffff
    field public static final int CAPABILITY_SUCCESS = 0; // 0x0
    field public static final int FEATURE_EMERGENCY_MMTEL = 0; // 0x0
    field public static final int FEATURE_MMTEL = 1; // 0x1
    field public static final int FEATURE_RCS = 2; // 0x2
    field public static final int STATE_INITIALIZING = 1; // 0x1
    field public static final int STATE_READY = 2; // 0x2
    field public static final int STATE_UNAVAILABLE = 0; // 0x0
  }

  @Deprecated public static class ImsFeature.Capabilities {
    field @Deprecated protected int mCapabilities;
  }

  protected static class ImsFeature.CapabilityCallbackProxy {
    method public void onChangeCapabilityConfigurationError(int, int, int);
  }

  public class MmTelFeature extends android.telephony.ims.feature.ImsFeature {
    ctor public MmTelFeature();
    method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
    method @Nullable public android.telephony.ims.ImsCallProfile createCallProfile(int, int);
    method @Nullable public android.telephony.ims.stub.ImsCallSessionImplBase createCallSession(@NonNull android.telephony.ims.ImsCallProfile);
    method @NonNull public android.telephony.ims.stub.ImsEcbmImplBase getEcbm();
    method @NonNull public android.telephony.ims.stub.ImsMultiEndpointImplBase getMultiEndpoint();
    method @NonNull public android.telephony.ims.stub.ImsSmsImplBase getSmsImplementation();
    method @NonNull public android.telephony.ims.stub.ImsUtImplBase getUt();
    method public final void notifyCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
    method public final void notifyIncomingCall(@NonNull android.telephony.ims.stub.ImsCallSessionImplBase, @NonNull android.os.Bundle);
    method public final void notifyRejectedCall(@NonNull android.telephony.ims.ImsCallProfile, @NonNull android.telephony.ims.ImsReasonInfo);
    method public final void notifyVoiceMessageCountUpdate(int);
    method public void onFeatureReady();
    method public void onFeatureRemoved();
    method public boolean queryCapabilityConfiguration(int, int);
    method @NonNull public final android.telephony.ims.feature.MmTelFeature.MmTelCapabilities queryCapabilityStatus();
    method public void setUiTtyMode(int, @Nullable android.os.Message);
    method public int shouldProcessCall(@NonNull String[]);
    field public static final String EXTRA_IS_UNKNOWN_CALL = "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";
    field public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD";
    field public static final int PROCESS_CALL_CSFB = 1; // 0x1
    field public static final int PROCESS_CALL_IMS = 0; // 0x0
  }

  public static class MmTelFeature.MmTelCapabilities extends android.telephony.ims.feature.ImsFeature.Capabilities {
    ctor public MmTelFeature.MmTelCapabilities();
    ctor @Deprecated public MmTelFeature.MmTelCapabilities(android.telephony.ims.feature.ImsFeature.Capabilities);
    ctor public MmTelFeature.MmTelCapabilities(int);
    method public final void addCapabilities(int);
    method public final boolean isCapable(int);
    method public final void removeCapabilities(int);
  }

  public class RcsFeature extends android.telephony.ims.feature.ImsFeature {
    ctor public RcsFeature();
    method public void changeEnabledCapabilities(@NonNull android.telephony.ims.feature.CapabilityChangeRequest, @NonNull android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
    method @NonNull public android.telephony.ims.stub.RcsSipOptionsImplBase getOptionsExchangeImpl();
    method @NonNull public android.telephony.ims.stub.RcsPresenceExchangeImplBase getPresenceExchangeImpl();
    method public final void notifyCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.RcsFeature.RcsImsCapabilities);
    method public void onFeatureReady();
    method public void onFeatureRemoved();
    method public boolean queryCapabilityConfiguration(int, int);
    method @NonNull public final android.telephony.ims.feature.RcsFeature.RcsImsCapabilities queryCapabilityStatus();
  }

  public static class RcsFeature.RcsImsCapabilities extends android.telephony.ims.feature.ImsFeature.Capabilities {
    ctor public RcsFeature.RcsImsCapabilities(int);
    method public void addCapabilities(int);
    method public boolean isCapable(int);
    method public void removeCapabilities(int);
    field public static final int CAPABILITY_TYPE_NONE = 0; // 0x0
    field public static final int CAPABILITY_TYPE_OPTIONS_UCE = 1; // 0x1
    field public static final int CAPABILITY_TYPE_PRESENCE_UCE = 2; // 0x2
  }

}

package android.telephony.ims.stub {

  public class ImsCallSessionImplBase implements java.lang.AutoCloseable {
    ctor public ImsCallSessionImplBase();
    method public void accept(int, android.telephony.ims.ImsStreamMediaProfile);
    method public void close();
    method public void deflect(String);
    method public void extendToConference(String[]);
    method public String getCallId();
    method public android.telephony.ims.ImsCallProfile getCallProfile();
    method public android.telephony.ims.ImsVideoCallProvider getImsVideoCallProvider();
    method public android.telephony.ims.ImsCallProfile getLocalCallProfile();
    method public String getProperty(String);
    method public android.telephony.ims.ImsCallProfile getRemoteCallProfile();
    method public int getState();
    method public void hold(android.telephony.ims.ImsStreamMediaProfile);
    method public void inviteParticipants(String[]);
    method public boolean isInCall();
    method public boolean isMultiparty();
    method public void merge();
    method public void reject(int);
    method public void removeParticipants(String[]);
    method public void resume(android.telephony.ims.ImsStreamMediaProfile);
    method public void sendDtmf(char, android.os.Message);
    method public void sendRttMessage(String);
    method public void sendRttModifyRequest(android.telephony.ims.ImsCallProfile);
    method public void sendRttModifyResponse(boolean);
    method public void sendUssd(String);
    method public void setListener(android.telephony.ims.ImsCallSessionListener);
    method public void setMute(boolean);
    method public void start(String, android.telephony.ims.ImsCallProfile);
    method public void startConference(String[], android.telephony.ims.ImsCallProfile);
    method public void startDtmf(char);
    method public void stopDtmf();
    method public void terminate(int);
    method public void update(int, android.telephony.ims.ImsStreamMediaProfile);
    field public static final int USSD_MODE_NOTIFY = 0; // 0x0
    field public static final int USSD_MODE_REQUEST = 1; // 0x1
  }

  public static class ImsCallSessionImplBase.State {
    method public static String toString(int);
    field public static final int ESTABLISHED = 4; // 0x4
    field public static final int ESTABLISHING = 3; // 0x3
    field public static final int IDLE = 0; // 0x0
    field public static final int INITIATED = 1; // 0x1
    field public static final int INVALID = -1; // 0xffffffff
    field public static final int NEGOTIATING = 2; // 0x2
    field public static final int REESTABLISHING = 6; // 0x6
    field public static final int RENEGOTIATING = 5; // 0x5
    field public static final int TERMINATED = 8; // 0x8
    field public static final int TERMINATING = 7; // 0x7
  }

  public class ImsConfigImplBase {
    ctor public ImsConfigImplBase();
    method public int getConfigInt(int);
    method public String getConfigString(int);
    method public final void notifyProvisionedValueChanged(int, int);
    method public final void notifyProvisionedValueChanged(int, String);
    method public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean);
    method public int setConfig(int, int);
    method public int setConfig(int, String);
    field public static final int CONFIG_RESULT_FAILED = 1; // 0x1
    field public static final int CONFIG_RESULT_SUCCESS = 0; // 0x0
    field public static final int CONFIG_RESULT_UNKNOWN = -1; // 0xffffffff
  }

  public class ImsEcbmImplBase {
    ctor public ImsEcbmImplBase();
    method public final void enteredEcbm();
    method public void exitEmergencyCallbackMode();
    method public final void exitedEcbm();
  }

  public final class ImsFeatureConfiguration implements android.os.Parcelable {
    method public int describeContents();
    method public java.util.Set<android.telephony.ims.stub.ImsFeatureConfiguration.FeatureSlotPair> getServiceFeatures();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.stub.ImsFeatureConfiguration> CREATOR;
  }

  public static class ImsFeatureConfiguration.Builder {
    ctor public ImsFeatureConfiguration.Builder();
    method public android.telephony.ims.stub.ImsFeatureConfiguration.Builder addFeature(int, int);
    method public android.telephony.ims.stub.ImsFeatureConfiguration build();
  }

  public static final class ImsFeatureConfiguration.FeatureSlotPair {
    ctor public ImsFeatureConfiguration.FeatureSlotPair(int, int);
    field public final int featureType;
    field public final int slotId;
  }

  public class ImsMultiEndpointImplBase {
    ctor public ImsMultiEndpointImplBase();
    method public final void onImsExternalCallStateUpdate(java.util.List<android.telephony.ims.ImsExternalCallState>);
    method public void requestImsExternalCallStateInfo();
  }

  public class ImsRegistrationImplBase {
    ctor public ImsRegistrationImplBase();
    method public final void onDeregistered(android.telephony.ims.ImsReasonInfo);
    method public final void onRegistered(int);
    method public final void onRegistering(int);
    method public final void onSubscriberAssociatedUriChanged(android.net.Uri[]);
    method public final void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo);
    field public static final int REGISTRATION_TECH_IWLAN = 1; // 0x1
    field public static final int REGISTRATION_TECH_LTE = 0; // 0x0
    field public static final int REGISTRATION_TECH_NONE = -1; // 0xffffffff
  }

  public class ImsSmsImplBase {
    ctor public ImsSmsImplBase();
    method public void acknowledgeSms(int, @IntRange(from=0, to=65535) int, int);
    method public void acknowledgeSmsReport(int, @IntRange(from=0, to=65535) int, int);
    method public String getSmsFormat();
    method public void onReady();
    method @Deprecated public final void onSendSmsResult(int, @IntRange(from=0, to=65535) int, int, int) throws java.lang.RuntimeException;
    method public final void onSendSmsResultError(int, @IntRange(from=0, to=65535) int, int, int, int) throws java.lang.RuntimeException;
    method public final void onSendSmsResultSuccess(int, @IntRange(from=0, to=65535) int) throws java.lang.RuntimeException;
    method public final void onSmsReceived(int, String, byte[]) throws java.lang.RuntimeException;
    method @Deprecated public final void onSmsStatusReportReceived(int, @IntRange(from=0, to=65535) int, String, byte[]) throws java.lang.RuntimeException;
    method public final void onSmsStatusReportReceived(int, String, byte[]) throws java.lang.RuntimeException;
    method public void sendSms(int, @IntRange(from=0, to=65535) int, String, String, boolean, byte[]);
    field public static final int DELIVER_STATUS_ERROR_GENERIC = 2; // 0x2
    field public static final int DELIVER_STATUS_ERROR_NO_MEMORY = 3; // 0x3
    field public static final int DELIVER_STATUS_ERROR_REQUEST_NOT_SUPPORTED = 4; // 0x4
    field public static final int DELIVER_STATUS_OK = 1; // 0x1
    field public static final int RESULT_NO_NETWORK_ERROR = -1; // 0xffffffff
    field public static final int SEND_STATUS_ERROR = 2; // 0x2
    field public static final int SEND_STATUS_ERROR_FALLBACK = 4; // 0x4
    field public static final int SEND_STATUS_ERROR_RETRY = 3; // 0x3
    field public static final int SEND_STATUS_OK = 1; // 0x1
    field public static final int STATUS_REPORT_STATUS_ERROR = 2; // 0x2
    field public static final int STATUS_REPORT_STATUS_OK = 1; // 0x1
  }

  public class ImsUtImplBase {
    ctor public ImsUtImplBase();
    method public void close();
    method public int queryCallBarring(int);
    method public int queryCallBarringForServiceClass(int, int);
    method public int queryCallForward(int, String);
    method public int queryCallWaiting();
    method public int queryClip();
    method public int queryClir();
    method public int queryColp();
    method public int queryColr();
    method public void setListener(android.telephony.ims.ImsUtListener);
    method public int transact(android.os.Bundle);
    method public int updateCallBarring(int, int, String[]);
    method public int updateCallBarringForServiceClass(int, int, String[], int);
    method public int updateCallBarringWithPassword(int, int, @Nullable String[], int, @NonNull String);
    method public int updateCallForward(int, int, String, int, int);
    method public int updateCallWaiting(boolean, int);
    method public int updateClip(boolean);
    method public int updateClir(int);
    method public int updateColp(boolean);
    method public int updateColr(int);
    field public static final int CALL_BARRING_ALL = 7; // 0x7
    field public static final int CALL_BARRING_ALL_INCOMING = 1; // 0x1
    field public static final int CALL_BARRING_ALL_OUTGOING = 2; // 0x2
    field public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; // 0x6
    field public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; // 0x9
    field public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; // 0x8
    field public static final int CALL_BARRING_OUTGOING_INTL = 3; // 0x3
    field public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; // 0x4
    field public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; // 0xa
    field public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; // 0x5
    field public static final int INVALID_RESULT = -1; // 0xffffffff
  }

  public class RcsCapabilityExchange {
    ctor public RcsCapabilityExchange();
    method public final void onCommandUpdate(int, int) throws android.telephony.ims.ImsException;
    field public static final int COMMAND_CODE_FETCH_ERROR = 4; // 0x4
    field public static final int COMMAND_CODE_GENERIC_FAILURE = 2; // 0x2
    field public static final int COMMAND_CODE_INSUFFICIENT_MEMORY = 6; // 0x6
    field public static final int COMMAND_CODE_INVALID_PARAM = 3; // 0x3
    field public static final int COMMAND_CODE_LOST_NETWORK_CONNECTION = 7; // 0x7
    field public static final int COMMAND_CODE_NOT_FOUND = 9; // 0x9
    field public static final int COMMAND_CODE_NOT_SUPPORTED = 8; // 0x8
    field public static final int COMMAND_CODE_NO_CHANGE_IN_CAP = 11; // 0xb
    field public static final int COMMAND_CODE_REQUEST_TIMEOUT = 5; // 0x5
    field public static final int COMMAND_CODE_SERVICE_UNAVAILABLE = 10; // 0xa
    field public static final int COMMAND_CODE_SERVICE_UNKNOWN = 0; // 0x0
    field public static final int COMMAND_CODE_SUCCESS = 1; // 0x1
  }

  public class RcsPresenceExchangeImplBase extends android.telephony.ims.stub.RcsCapabilityExchange {
    ctor public RcsPresenceExchangeImplBase();
    method public final void onCapabilityRequestResponse(@NonNull java.util.List<android.telephony.ims.RcsContactUceCapability>, int) throws android.telephony.ims.ImsException;
    method public final void onNetworkResponse(int, @NonNull String, int) throws android.telephony.ims.ImsException;
    method public final void onNotifyUpdateCapabilites(int) throws android.telephony.ims.ImsException;
    method public final void onUnpublish() throws android.telephony.ims.ImsException;
    method public void requestCapabilities(@NonNull java.util.List<android.net.Uri>, int);
    method public void updateCapabilities(@NonNull android.telephony.ims.RcsContactUceCapability, int);
    field public static final int CAPABILITY_UPDATE_TRIGGER_ETAG_EXPIRED = 0; // 0x0
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_2G = 6; // 0x6
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_3G = 5; // 0x5
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_EHRPD = 3; // 0x3
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_HSPAPLUS = 4; // 0x4
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_IWLAN = 8; // 0x8
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_DISABLED = 1; // 0x1
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_ENABLED = 2; // 0x2
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_DISABLED = 10; // 0xa
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_ENABLED = 11; // 0xb
    field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_WLAN = 7; // 0x7
    field public static final int CAPABILITY_UPDATE_TRIGGER_UNKNOWN = 9; // 0x9
    field public static final int RESPONSE_FORBIDDEN = 3; // 0x3
    field public static final int RESPONSE_NOT_AUTHORIZED_FOR_PRESENCE = 2; // 0x2
    field public static final int RESPONSE_NOT_FOUND = 4; // 0x4
    field public static final int RESPONSE_NOT_REGISTERED = 1; // 0x1
    field public static final int RESPONSE_SIP_INTERVAL_TOO_SHORT = 7; // 0x7
    field public static final int RESPONSE_SIP_REQUEST_TIMEOUT = 5; // 0x5
    field public static final int RESPONSE_SIP_SERVICE_UNAVAILABLE = 8; // 0x8
    field public static final int RESPONSE_SUBSCRIBE_GENERIC_FAILURE = -1; // 0xffffffff
    field public static final int RESPONSE_SUBSCRIBE_TOO_LARGE = 6; // 0x6
    field public static final int RESPONSE_SUCCESS = 0; // 0x0
  }

  public class RcsSipOptionsImplBase extends android.telephony.ims.stub.RcsCapabilityExchange {
    ctor public RcsSipOptionsImplBase();
    method public final void onCapabilityRequestResponse(int, @NonNull String, @Nullable android.telephony.ims.RcsContactUceCapability, int) throws android.telephony.ims.ImsException;
    method public final void onRemoteCapabilityRequest(@NonNull android.net.Uri, @NonNull android.telephony.ims.RcsContactUceCapability, int) throws android.telephony.ims.ImsException;
    method public void respondToCapabilityRequest(@NonNull String, @NonNull android.telephony.ims.RcsContactUceCapability, int);
    method public void respondToCapabilityRequestWithError(@NonNull android.net.Uri, int, @NonNull String, int);
    method public void sendCapabilityRequest(@NonNull android.net.Uri, @NonNull android.telephony.ims.RcsContactUceCapability, int);
    field public static final int RESPONSE_BAD_REQUEST = 5; // 0x5
    field public static final int RESPONSE_DOES_NOT_EXIST_ANYWHERE = 4; // 0x4
    field public static final int RESPONSE_GENERIC_FAILURE = -1; // 0xffffffff
    field public static final int RESPONSE_NOT_FOUND = 3; // 0x3
    field public static final int RESPONSE_REQUEST_TIMEOUT = 2; // 0x2
    field public static final int RESPONSE_SUCCESS = 0; // 0x0
    field public static final int RESPONSE_TEMPORARILY_UNAVAILABLE = 1; // 0x1
  }

}

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 NOTIF_CONVO_BYPASS_SHORTCUT_REQ = "settings_notif_convo_bypass_shortcut_req";
    field public static final String PERSIST_PREFIX = "persist.sys.fflag.override.";
    field public static final String SCREENRECORD_LONG_PRESS = "settings_screenrecord_long_press";
    field public static final String SEAMLESS_TRANSFER = "settings_seamless_transfer";
    field public static final String SETTINGS_FUSE_FLAG = "settings_fuse";
    field public static final String SETTINGS_WIFITRACKER2 = "settings_wifitracker2";
  }

  public class SparseArrayMap<T> {
    ctor public SparseArrayMap();
    method public void add(int, @NonNull String, @Nullable T);
    method public void clear();
    method public boolean contains(int, @NonNull String);
    method public void delete(int);
    method @Nullable public T delete(int, @NonNull String);
    method public void forEach(@NonNull java.util.function.Consumer<T>);
    method @Nullable public T get(int, @NonNull String);
    method @Nullable public T getOrDefault(int, @NonNull String, T);
    method public int indexOfKey(int);
    method public int indexOfKey(int, @NonNull String);
    method public int keyAt(int);
    method @NonNull public String keyAt(int, int);
    method public int numElementsForKey(int);
    method public int numMaps();
    method @Nullable public T valueAt(int, int);
  }

  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 class ProtoParseException extends java.lang.RuntimeException {
    ctor public ProtoParseException(String);
  }

  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 @NonNull public android.graphics.ColorSpace[] getSupportedWideColorGamut();
    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);
    method public final void setShowingLayoutBounds(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=0x800, equals=0x800, name="DISABLE_WALLPAPER_TOUCH_EVENTS"), @android.view.ViewDebug.FlagToString(mask=0x1000, equals=0x1000, name="FORCE_STATUS_BAR_VISIBLE"), @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"), @android.view.ViewDebug.FlagToString(mask=0x4000000, equals=0x4000000, name="APPEARANCE_CONTROLLED"), @android.view.ViewDebug.FlagToString(mask=0x8000000, equals=0x8000000, name="BEHAVIOR_CONTROLLED"), @android.view.ViewDebug.FlagToString(mask=0x10000000, equals=0x10000000, name="FIT_INSETS_CONTROLLED")}) 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 @NonNull @RequiresPermission("android.permission.MANAGE_ACCESSIBILITY") public java.util.List<java.lang.String> getAccessibilityShortcutTargets(int);
    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 void addChild(@NonNull android.os.IBinder);
    method public void setLeashedParent(@Nullable android.os.IBinder, int);
    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 InlineSuggestion implements android.os.Parcelable {
    method @NonNull public static android.view.inputmethod.InlineSuggestion newInlineSuggestion(@NonNull android.view.inputmethod.InlineSuggestionInfo);
  }

  public final class InlineSuggestionInfo implements android.os.Parcelable {
    method @NonNull public static android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(@NonNull android.view.inline.InlinePresentationSpec, @NonNull String, @Nullable String[]);
  }

  public final class InlineSuggestionsResponse implements android.os.Parcelable {
    method @NonNull public static android.view.inputmethod.InlineSuggestionsResponse newInlineSuggestionsResponse(@NonNull java.util.List<android.view.inputmethod.InlineSuggestion>);
  }

  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();
  }

}

