package android {

  public static final class Manifest.permission {
    field public static final java.lang.String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
    field public static final java.lang.String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
    field public static final java.lang.String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
    field public static final java.lang.String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
    field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final java.lang.String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
    field public static final java.lang.String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
  }

}

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 ActivityManager {
    method public void addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int);
    method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName);
    method public int getPackageImportance(java.lang.String);
    method public long getTotalRam();
    method public int getUidImportance(int);
    method public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
  }

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

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

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

  public class ActivityTaskManager {
    method public void removeStacksInWindowingModes(int[]) throws java.lang.SecurityException;
    method public void removeStacksWithActivityTypes(int[]) throws java.lang.SecurityException;
    method public void resizeStack(int, android.graphics.Rect) throws java.lang.SecurityException;
    method public void setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException;
    method public void setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException;
    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 AppOpsManager {
    method public static int getNumOps();
    method public static java.lang.String[] getOpStrs();
    method public boolean isOperationActive(int, int, java.lang.String);
    method public static java.lang.String opToPermission(int);
    method public static int permissionToOpCode(java.lang.String);
    method public void setMode(int, int, java.lang.String, int);
    method public void startWatchingActive(int[], android.app.AppOpsManager.OnOpActiveChangedListener);
    method public void stopWatchingActive(android.app.AppOpsManager.OnOpActiveChangedListener);
    method public static int strOpToOp(java.lang.String);
    field public static final java.lang.String OPSTR_ACCEPT_HANDOVER = "android:accept_handover";
    field public static final java.lang.String OPSTR_ACCESS_NOTIFICATIONS = "android:access_notifications";
    field public static final java.lang.String OPSTR_ACTIVATE_VPN = "android:activate_vpn";
    field public static final java.lang.String OPSTR_ASSIST_SCREENSHOT = "android:assist_screenshot";
    field public static final java.lang.String OPSTR_ASSIST_STRUCTURE = "android:assist_structure";
    field public static final java.lang.String OPSTR_AUDIO_ACCESSIBILITY_VOLUME = "android:audio_accessibility_volume";
    field public static final java.lang.String OPSTR_AUDIO_ALARM_VOLUME = "android:audio_alarm_volume";
    field public static final java.lang.String OPSTR_AUDIO_BLUETOOTH_VOLUME = "android:audio_bluetooth_volume";
    field public static final java.lang.String OPSTR_AUDIO_MASTER_VOLUME = "android:audio_master_volume";
    field public static final java.lang.String OPSTR_AUDIO_MEDIA_VOLUME = "android:audio_media_volume";
    field public static final java.lang.String OPSTR_AUDIO_NOTIFICATION_VOLUME = "android:audio_notification_volume";
    field public static final java.lang.String OPSTR_AUDIO_RING_VOLUME = "android:audio_ring_volume";
    field public static final java.lang.String OPSTR_AUDIO_VOICE_VOLUME = "android:audio_voice_volume";
    field public static final java.lang.String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service";
    field public static final java.lang.String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state";
    field public static final java.lang.String OPSTR_GET_ACCOUNTS = "android:get_accounts";
    field public static final java.lang.String OPSTR_GPS = "android:gps";
    field public static final java.lang.String OPSTR_INSTANT_APP_START_FOREGROUND = "android:instant_app_start_foreground";
    field public static final java.lang.String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
    field public static final java.lang.String OPSTR_MUTE_MICROPHONE = "android:mute_microphone";
    field public static final java.lang.String OPSTR_NEIGHBORING_CELLS = "android:neighboring_cells";
    field public static final java.lang.String OPSTR_PLAY_AUDIO = "android:play_audio";
    field public static final java.lang.String OPSTR_POST_NOTIFICATION = "android:post_notification";
    field public static final java.lang.String OPSTR_PROJECT_MEDIA = "android:project_media";
    field public static final java.lang.String OPSTR_READ_CLIPBOARD = "android:read_clipboard";
    field public static final java.lang.String OPSTR_READ_ICC_SMS = "android:read_icc_sms";
    field public static final java.lang.String OPSTR_RECEIVE_EMERGENCY_BROADCAST = "android:receive_emergency_broadcast";
    field public static final java.lang.String OPSTR_REQUEST_DELETE_PACKAGES = "android:request_delete_packages";
    field public static final java.lang.String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages";
    field public static final java.lang.String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background";
    field public static final java.lang.String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background";
    field public static final java.lang.String OPSTR_START_FOREGROUND = "android:start_foreground";
    field public static final java.lang.String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus";
    field public static final java.lang.String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons";
    field public static final java.lang.String OPSTR_TOAST_WINDOW = "android:toast_window";
    field public static final java.lang.String OPSTR_TURN_SCREEN_ON = "android:turn_screen_on";
    field public static final java.lang.String OPSTR_VIBRATE = "android:vibrate";
    field public static final java.lang.String OPSTR_WAKE_LOCK = "android:wake_lock";
    field public static final java.lang.String OPSTR_WIFI_SCAN = "android:wifi_scan";
    field public static final java.lang.String OPSTR_WRITE_CLIPBOARD = "android:write_clipboard";
    field public static final java.lang.String OPSTR_WRITE_ICC_SMS = "android:write_icc_sms";
    field public static final java.lang.String OPSTR_WRITE_SMS = "android:write_sms";
    field public static final java.lang.String OPSTR_WRITE_WALLPAPER = "android:write_wallpaper";
    field public static final int OP_RECORD_AUDIO = 27; // 0x1b
    field public static final int OP_SYSTEM_ALERT_WINDOW = 24; // 0x18
  }

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

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

  public class NotificationManager {
    method public android.content.ComponentName getEffectsSuppressor();
  }

  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 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(java.lang.String);
    method public deprecated boolean grantRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    method public deprecated boolean revokeRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
  }

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

  public class WindowConfiguration implements java.lang.Comparable 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 getWindowingMode();
    method public void setActivityType(int);
    method public void setAppBounds(android.graphics.Rect);
    method public void setBounds(android.graphics.Rect);
    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 WINDOWING_MODE_FREEFORM = 5; // 0x5
    field public static final int WINDOWING_MODE_FULLSCREEN = 1; // 0x1
    field public static final int WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY = 4; // 0x4
    field public static final int WINDOWING_MODE_PINNED = 2; // 0x2
    field public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY = 3; // 0x3
    field public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY = 4; // 0x4
    field public static final int WINDOWING_MODE_UNDEFINED = 0; // 0x0
  }

}

package android.app.admin {

  public class DevicePolicyManager {
    method public java.lang.CharSequence getDeviceOwnerOrganizationName();
    method public long getLastBugReportRequestTime();
    method public long getLastNetworkLogRetrievalTime();
    method public long getLastSecurityLogRetrievalTime();
    method public java.util.List<java.lang.String> getOwnerInstalledCaCerts(android.os.UserHandle);
    method public boolean isCurrentInputMethodSetByOwner();
    method public boolean isDeviceManaged();
    field public static final java.lang.String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED";
    field public static final java.lang.String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_DISALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_DISALLOWED";
    field public static final java.lang.String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
    field public static final java.lang.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.backup {

  public class BackupManager {
    method public android.content.Intent getConfigurationIntent(java.lang.String);
    method public android.content.Intent getDataManagementIntent(java.lang.String);
    method public java.lang.String getDataManagementLabel(java.lang.String);
    method public java.lang.String getDestinationString(java.lang.String);
  }

}

package android.app.usage {

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

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

}

package android.content {

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

  public abstract class Context {
    method public abstract java.lang.String getOpPackageName();
    method public android.os.UserHandle getUser();
    method public int getUserId();
    method public void setAutofillCompatibilityEnabled(boolean);
  }

  public class ContextWrapper extends android.content.Context {
    method public java.lang.String getOpPackageName();
  }

}

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 abstract class PackageManager {
    method public abstract boolean arePermissionsIndividuallyControlled();
    method public abstract java.lang.String getDefaultBrowserPackageNameAsUser(int);
    method public abstract int getInstallReason(java.lang.String, android.os.UserHandle);
    method public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
    method public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
    method public abstract java.lang.String[] getNamesForUids(int[]);
    method public abstract java.lang.String getPermissionControllerPackageName();
    method public abstract java.lang.String getServicesSystemSharedLibraryPackageName();
    method public abstract java.lang.String getSharedSystemSharedLibraryPackageName();
    method public abstract void grantRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract void revokeRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    field public static final java.lang.String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
    field public static final java.lang.String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
    field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000
    field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000
    field public static final java.lang.String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
    field public static final java.lang.String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
  }

  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
    field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
    field public java.lang.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 Configuration implements java.lang.Comparable android.os.Parcelable {
    field public final android.app.WindowConfiguration windowConfiguration;
  }

}

package android.database.sqlite {

  public final class SQLiteDebug {
    method public static void dump(android.util.Printer, java.lang.String[]);
    method public static android.database.sqlite.SQLiteDebug.PagerStats getDatabaseInfo();
    field public static final boolean DEBUG_SQL_LOG;
    field public static final boolean DEBUG_SQL_STATEMENTS;
    field public static final boolean DEBUG_SQL_TIME;
  }

  public static class SQLiteDebug.DbStats {
    ctor public SQLiteDebug.DbStats(java.lang.String, long, long, int, int, int, int);
    field public java.lang.String cache;
    field public java.lang.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, java.lang.String, java.lang.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, java.lang.String[]);
    method public void setBindArguments(java.lang.String[]);
  }

  public final class SQLiteGlobal {
    method public static java.lang.String getDefaultJournalMode();
    method public static int getDefaultPageSize();
    method public static java.lang.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 java.lang.String getWALSyncMode();
    method public static boolean isCompatibilityWalSupported();
    method public static int releaseMemory();
  }

}

package android.graphics {

  public final class ImageDecoder implements java.lang.AutoCloseable {
    method 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(android.graphics.Xfermode);
  }

}

package android.hardware.camera2 {

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

}

package android.hardware.display {

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

  public final class BrightnessChangeEvent implements android.os.Parcelable {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field 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 int colorTemperature;
    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 java.lang.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 public android.util.Pair<float[], float[]> getCurve();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
  }

  public static class BrightnessConfiguration.Builder {
    ctor public BrightnessConfiguration.Builder(float[], float[]);
    method public android.hardware.display.BrightnessConfiguration build();
    method public android.hardware.display.BrightnessConfiguration.Builder setDescription(java.lang.String);
  }

  public final class DisplayManager {
    method public java.util.List<android.hardware.display.AmbientBrightnessDayStats> getAmbientBrightnessStats();
    method public android.hardware.display.BrightnessConfiguration getBrightnessConfiguration();
    method public java.util.List<android.hardware.display.BrightnessChangeEvent> getBrightnessEvents();
    method public android.hardware.display.BrightnessConfiguration getDefaultBrightnessConfiguration();
    method public android.graphics.Point getStableDisplaySize();
    method public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
  }

}

package android.location {

  public final class GnssClock implements android.os.Parcelable {
    ctor public GnssClock();
    method public void reset();
    method public void resetBiasNanos();
    method public void resetBiasUncertaintyNanos();
    method public void resetDriftNanosPerSecond();
    method public void resetDriftUncertaintyNanosPerSecond();
    method public void resetFullBiasNanos();
    method public void resetLeapSecond();
    method public void resetTimeUncertaintyNanos();
    method public void set(android.location.GnssClock);
    method public void setBiasNanos(double);
    method public void setBiasUncertaintyNanos(double);
    method public void setDriftNanosPerSecond(double);
    method public void setDriftUncertaintyNanosPerSecond(double);
    method public void setFullBiasNanos(long);
    method public void setHardwareClockDiscontinuityCount(int);
    method public void setLeapSecond(int);
    method public void setTimeNanos(long);
    method public void setTimeUncertaintyNanos(double);
  }

  public final class GnssMeasurement implements android.os.Parcelable {
    ctor public GnssMeasurement();
    method public void reset();
    method public void resetAutomaticGainControlLevel();
    method public deprecated void resetCarrierCycles();
    method public void resetCarrierFrequencyHz();
    method public deprecated void resetCarrierPhase();
    method public deprecated void resetCarrierPhaseUncertainty();
    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 deprecated void setCarrierCycles(long);
    method public void setCarrierFrequencyHz(float);
    method public deprecated void setCarrierPhase(double);
    method public deprecated void setCarrierPhaseUncertainty(double);
    method public void setCn0DbHz(double);
    method public void setConstellationType(int);
    method public void setMultipathIndicator(int);
    method public void setPseudorangeRateMetersPerSecond(double);
    method public void setPseudorangeRateUncertaintyMetersPerSecond(double);
    method public void setReceivedSvTimeNanos(long);
    method public void setReceivedSvTimeUncertaintyNanos(long);
    method public void setSnrInDb(double);
    method public void setState(int);
    method public void setSvid(int);
    method public void setTimeOffsetNanos(double);
    field public static final int ADR_STATE_ALL = 31; // 0x1f
  }

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

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

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

  public class LocationManager {
    method public java.lang.String[] getBackgroundThrottlingWhitelist();
  }

}

package android.media {

  public final class AudioFocusRequest {
    method 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 final class AudioPresentation {
    ctor public AudioPresentation(int, int, java.util.Map<java.lang.String, java.lang.String>, java.lang.String, int, boolean, boolean, boolean);
    method public int getPresentationId();
    method public int getProgramId();
  }

  public final class BufferingParams implements android.os.Parcelable {
    method public int describeContents();
    method public int getInitialMarkMs();
    method public int getResumePlaybackMarkMs();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.media.BufferingParams> CREATOR;
  }

  public static class BufferingParams.Builder {
    ctor public BufferingParams.Builder();
    ctor public BufferingParams.Builder(android.media.BufferingParams);
    method public android.media.BufferingParams build();
    method public android.media.BufferingParams.Builder setInitialMarkMs(int);
    method public android.media.BufferingParams.Builder setResumePlaybackMarkMs(int);
  }

  public class MediaPlayer implements android.media.AudioRouting android.media.VolumeAutomation {
    method public android.media.BufferingParams getBufferingParams();
    method public void setBufferingParams(android.media.BufferingParams);
  }

  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 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 abstract interface AudioEffect.OnParameterChangeListener {
    method public abstract void onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]);
  }

}

package android.net {

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

  public final class NetworkCapabilities implements android.os.Parcelable {
    method public int[] getCapabilities();
    method public int[] getTransportTypes();
  }

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

  public class Build {
    method public static boolean is64BitAbi(java.lang.String);
  }

  public static class Build.VERSION {
    field public static final int FIRST_SDK_INT;
    field public static final int RESOURCES_SDK_INT;
  }

  public class DeviceIdleManager {
    method public java.lang.String[] getSystemPowerWhitelist();
    method public java.lang.String[] getSystemPowerWhitelistExceptIdle();
  }

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

  public class IncidentManager {
    method public void reportIncident(android.os.IncidentReportArgs);
  }

  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 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 class Process {
    method public static final int getThreadScheduler(int) throws java.lang.IllegalArgumentException;
  }

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

  public static abstract interface RemoteCallback.OnResultListener {
    method public abstract void onResult(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 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, java.lang.String);
    method public java.lang.String getStackTrace();
    method public java.lang.Class<? extends android.os.strictmode.Violation> getViolationClass();
    method public java.lang.String getViolationDetails();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.os.StrictMode.ViolationInfo> CREATOR;
    field public java.lang.String broadcastIntentAction;
    field public int durationMillis;
    field public int numAnimationsRunning;
    field public long numInstances;
    field public java.lang.String[] tags;
    field public int violationNumThisLoop;
    field public long violationUptimeMillis;
  }

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

  public class SystemProperties {
    method public static java.lang.String get(java.lang.String);
    method public static java.lang.String get(java.lang.String, java.lang.String);
  }

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

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

  public abstract class VibrationEffect implements android.os.Parcelable {
    method public static android.os.VibrationEffect get(int);
    method public static android.os.VibrationEffect get(int, boolean);
    method 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_CLICK = 0; // 0x0
    field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1
    field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5
    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_THUD = 3; // 0x3
    field public static final int EFFECT_TICK = 2; // 0x2
    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 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 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 public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Waveform> CREATOR;
  }

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

}

package android.os.health {

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

  public static abstract class HealthKeys.Constant implements java.lang.annotation.Annotation {
  }

  public static class HealthKeys.Constants {
    ctor public HealthKeys.Constants(java.lang.Class);
    method public java.lang.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 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, java.lang.String, long);
    method public void addStats(int, java.lang.String, android.os.health.HealthStatsWriter);
    method public void addTimer(int, int, long);
    method public void addTimers(int, java.lang.String, android.os.health.TimerStat);
    method public void flattenToParcel(android.os.Parcel);
  }

}

package android.os.storage {

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

}

package android.os.strictmode {

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

}

package android.print {

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

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

}

package android.provider {

  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.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 Settings {
    field public static final java.lang.String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
  }

  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
    field public static final java.lang.String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
    field public static final java.lang.String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
    field public static final java.lang.String LOCATION_GLOBAL_KILL_SWITCH = "location_global_kill_switch";
    field public static final java.lang.String LOW_POWER_MODE = "low_power";
    field public static final java.lang.String LOW_POWER_MODE_STICKY = "low_power_sticky";
    field public static final java.lang.String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
  }

  public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
    field public static final java.lang.String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = "accessibility_display_magnification_enabled";
    field public static final java.lang.String AUTOFILL_FEATURE_FIELD_CLASSIFICATION = "autofill_field_classification";
    field public static final java.lang.String AUTOFILL_SERVICE = "autofill_service";
    field public static final java.lang.String AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT = "autofill_user_data_max_category_count";
    field public static final java.lang.String AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE = "autofill_user_data_max_field_classification_size";
    field public static final java.lang.String AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE = "autofill_user_data_max_user_data_size";
    field public static final java.lang.String AUTOFILL_USER_DATA_MAX_VALUE_LENGTH = "autofill_user_data_max_value_length";
    field public static final java.lang.String AUTOFILL_USER_DATA_MIN_VALUE_LENGTH = "autofill_user_data_min_value_length";
    field public static final java.lang.String DISABLED_PRINT_SERVICES = "disabled_print_services";
    field public static final deprecated java.lang.String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = "enabled_notification_policy_access_packages";
    field public static final java.lang.String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
    field public static final java.lang.String USER_SETUP_COMPLETE = "user_setup_complete";
    field public static final java.lang.String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
  }

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

}

package android.security {

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

}

package android.security.keystore {

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

  public static final class KeyGenParameterSpec.Builder {
    method 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.autofill {

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

  public final class DateTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(android.service.autofill.ValueFinder, 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 public android.view.autofill.AutofillValue sanitize(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(android.service.autofill.ValueFinder, android.widget.RemoteViews, int) throws java.lang.Exception;
  }

  public abstract class InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public InternalSanitizer();
  }

  public abstract class InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    ctor public InternalTransformation();
  }

  public abstract class InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
    ctor public InternalValidator();
    method public abstract boolean isValid(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(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(android.service.autofill.ValueFinder);
  }

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

  public abstract interface ValueFinder {
    method public default java.lang.String findByAutofillId(android.view.autofill.AutofillId);
    method public abstract android.view.autofill.AutofillValue findRawValueByAutofillId(android.view.autofill.AutofillId);
  }

}

package android.service.notification {

  public final class Adjustment implements android.os.Parcelable {
    ctor public Adjustment(java.lang.String, java.lang.String, android.os.Bundle, java.lang.CharSequence, int);
    ctor protected Adjustment(android.os.Parcel);
    method public int describeContents();
    method public java.lang.CharSequence getExplanation();
    method public java.lang.String getKey();
    method public java.lang.String getPackage();
    method public android.os.Bundle getSignals();
    method public int getUser();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
    field public static final java.lang.String KEY_PEOPLE = "key_people";
    field public static final java.lang.String KEY_SMART_ACTIONS = "key_smart_actions";
    field public static final java.lang.String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
    field public static final java.lang.String KEY_USER_SENTIMENT = "key_user_sentiment";
  }

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

  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
    ctor public NotificationAssistantService();
    method public final void adjustNotification(android.service.notification.Adjustment);
    method public final void adjustNotifications(java.util.List<android.service.notification.Adjustment>);
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
    method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String);
    method public final void unsnoozeNotification(java.lang.String);
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
  }

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

  public final class NotificationStats implements android.os.Parcelable {
    ctor public NotificationStats();
    ctor protected NotificationStats(android.os.Parcel);
    method public int describeContents();
    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 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 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
  }

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

}

package android.service.quicksettings {

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

}

package android.telecom {

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

}

package android.telephony {

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

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

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

  public class TelephonyManager {
    method public int getCarrierIdListVersion();
    method public void refreshUiccProfile();
    method public void setCarrierTestOverride(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String);
    field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
  }

}

package android.telephony.mbms {

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

  public final class FileInfo implements android.os.Parcelable {
    ctor public FileInfo(android.net.Uri, java.lang.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>, java.lang.String, java.util.List<java.util.Locale>, java.lang.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>, java.lang.String, java.util.List<java.util.Locale>, java.lang.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 public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
  }

}

package android.telephony.mbms.vendor {

  public class MbmsDownloadServiceBase extends android.os.Binder {
    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 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 public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads(int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    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, java.lang.String) throws android.os.RemoteException;
  }

  public class MbmsStreamingServiceBase extends android.os.Binder {
    ctor public MbmsStreamingServiceBase();
    method public void dispose(int) throws android.os.RemoteException;
    method public android.net.Uri getPlaybackUri(int, java.lang.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 int requestUpdateStreamingServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
    method public int startStreaming(int, java.lang.String, android.telephony.mbms.StreamingServiceCallback) throws android.os.RemoteException;
    method public void stopStreaming(int, java.lang.String) throws android.os.RemoteException;
  }

  public class VendorUtils {
    ctor public VendorUtils();
    method public static android.content.ComponentName getAppReceiverFromPackageName(android.content.Context, java.lang.String);
    field public static final java.lang.String ACTION_CLEANUP = "android.telephony.mbms.action.CLEANUP";
    field public static final java.lang.String ACTION_DOWNLOAD_RESULT_INTERNAL = "android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL";
    field public static final java.lang.String ACTION_FILE_DESCRIPTOR_REQUEST = "android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST";
    field public static final java.lang.String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT";
    field public static final java.lang.String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI";
    field public static final java.lang.String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST";
    field public static final java.lang.String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST";
    field public static final java.lang.String EXTRA_PAUSED_URI_LIST = "android.telephony.mbms.extra.PAUSED_URI_LIST";
    field public static final java.lang.String EXTRA_SERVICE_ID = "android.telephony.mbms.extra.SERVICE_ID";
    field public static final java.lang.String EXTRA_TEMP_FILES_IN_USE = "android.telephony.mbms.extra.TEMP_FILES_IN_USE";
    field public static final java.lang.String EXTRA_TEMP_FILE_ROOT = "android.telephony.mbms.extra.TEMP_FILE_ROOT";
    field public static final java.lang.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(java.lang.CharSequence, int, int, int);
    method public void onTextChanged(java.lang.CharSequence, int, int, int);
  }

}

package android.transition {

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

}

package android.util.proto {

  public final class EncodedBuffer {
    ctor public EncodedBuffer();
    ctor public EncodedBuffer(int);
    method public void dumpBuffers(java.lang.String);
    method public static void dumpByteString(java.lang.String, java.lang.String, byte[]);
    method public void editRawFixed32(int, int);
    method public byte[] getBytes(int);
    method public int getChunkCount();
    method public java.lang.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 getWriteBufIndex();
    method public int getWriteIndex();
    method public int getWritePos();
    method public byte readRawByte();
    method public int readRawFixed32();
    method public long readRawUnsigned();
    method public void rewindRead();
    method public void rewindWriteTo(int);
    method public void skipRead(int);
    method public void startEditing();
    method public void writeFromThisBuffer(int, int);
    method public void writeRawBuffer(byte[]);
    method public void writeRawBuffer(byte[], int, int);
    method public void writeRawByte(byte);
    method public void writeRawFixed32(int);
    method public void writeRawFixed64(long);
    method public void writeRawVarint32(int);
    method public void writeRawVarint64(long);
    method public void writeRawZigZag32(int);
    method public void writeRawZigZag64(long);
  }

  public final class ProtoOutputStream {
    ctor public ProtoOutputStream();
    ctor public ProtoOutputStream(int);
    ctor public ProtoOutputStream(java.io.OutputStream);
    ctor public ProtoOutputStream(java.io.FileDescriptor);
    method public static int checkFieldId(long, long);
    method public static int convertObjectIdToOrdinal(int);
    method public void dump(java.lang.String);
    method public void end(long);
    method public deprecated void endObject(long);
    method public deprecated void endRepeatedObject(long);
    method public void flush();
    method public byte[] getBytes();
    method public static int getDepthFromToken(long);
    method public static int getObjectIdFromToken(long);
    method public static boolean getRepeatedFromToken(long);
    method public static int getSizePosFromToken(long);
    method public static int getTagSizeFromToken(long);
    method public static long makeFieldId(int, long);
    method public static long makeToken(int, boolean, int, int, int);
    method public long start(long);
    method public deprecated long startObject(long);
    method public deprecated long startRepeatedObject(long);
    method public static java.lang.String token2String(long);
    method public void write(long, double);
    method public void write(long, float);
    method public void write(long, int);
    method public void write(long, long);
    method public void write(long, boolean);
    method public void write(long, java.lang.String);
    method public void write(long, byte[]);
    method public deprecated void writeBool(long, boolean);
    method public deprecated void writeBytes(long, byte[]);
    method public deprecated void writeDouble(long, double);
    method public deprecated void writeEnum(long, int);
    method public deprecated void writeFixed32(long, int);
    method public deprecated void writeFixed64(long, long);
    method public deprecated void writeFloat(long, float);
    method public deprecated void writeInt32(long, int);
    method public deprecated void writeInt64(long, long);
    method public deprecated void writeObject(long, byte[]);
    method public deprecated void writePackedBool(long, boolean[]);
    method public deprecated void writePackedDouble(long, double[]);
    method public deprecated void writePackedEnum(long, int[]);
    method public deprecated void writePackedFixed32(long, int[]);
    method public deprecated void writePackedFixed64(long, long[]);
    method public deprecated void writePackedFloat(long, float[]);
    method public deprecated void writePackedInt32(long, int[]);
    method public deprecated void writePackedInt64(long, long[]);
    method public deprecated void writePackedSFixed32(long, int[]);
    method public deprecated void writePackedSFixed64(long, long[]);
    method public deprecated void writePackedSInt32(long, int[]);
    method public deprecated void writePackedSInt64(long, long[]);
    method public deprecated void writePackedUInt32(long, int[]);
    method public deprecated void writePackedUInt64(long, long[]);
    method public deprecated void writeRepeatedBool(long, boolean);
    method public deprecated void writeRepeatedBytes(long, byte[]);
    method public deprecated void writeRepeatedDouble(long, double);
    method public deprecated void writeRepeatedEnum(long, int);
    method public deprecated void writeRepeatedFixed32(long, int);
    method public deprecated void writeRepeatedFixed64(long, long);
    method public deprecated void writeRepeatedFloat(long, float);
    method public deprecated void writeRepeatedInt32(long, int);
    method public deprecated void writeRepeatedInt64(long, long);
    method public deprecated void writeRepeatedObject(long, byte[]);
    method public deprecated void writeRepeatedSFixed32(long, int);
    method public deprecated void writeRepeatedSFixed64(long, long);
    method public deprecated void writeRepeatedSInt32(long, int);
    method public deprecated void writeRepeatedSInt64(long, long);
    method public deprecated void writeRepeatedString(long, java.lang.String);
    method public deprecated void writeRepeatedUInt32(long, int);
    method public deprecated void writeRepeatedUInt64(long, long);
    method public deprecated void writeSFixed32(long, int);
    method public deprecated void writeSFixed64(long, long);
    method public deprecated void writeSInt32(long, int);
    method public deprecated void writeSInt64(long, long);
    method public deprecated void writeString(long, java.lang.String);
    method public void writeTag(int, int);
    method public deprecated void writeUInt32(long, int);
    method public deprecated void writeUInt64(long, long);
    field public static final long FIELD_COUNT_MASK = 16492674416640L; // 0xf0000000000L
    field public static final long FIELD_COUNT_PACKED = 5497558138880L; // 0x50000000000L
    field public static final long FIELD_COUNT_REPEATED = 2199023255552L; // 0x20000000000L
    field public static final int FIELD_COUNT_SHIFT = 40; // 0x28
    field public static final long FIELD_COUNT_SINGLE = 1099511627776L; // 0x10000000000L
    field public static final long FIELD_COUNT_UNKNOWN = 0L; // 0x0L
    field public static final int FIELD_ID_MASK = -8; // 0xfffffff8
    field public static final int FIELD_ID_SHIFT = 3; // 0x3
    field public static final long FIELD_TYPE_BOOL = 34359738368L; // 0x800000000L
    field public static final long FIELD_TYPE_BYTES = 51539607552L; // 0xc00000000L
    field public static final long FIELD_TYPE_DOUBLE = 4294967296L; // 0x100000000L
    field public static final long FIELD_TYPE_ENUM = 60129542144L; // 0xe00000000L
    field public static final long FIELD_TYPE_FIXED32 = 30064771072L; // 0x700000000L
    field public static final long FIELD_TYPE_FIXED64 = 25769803776L; // 0x600000000L
    field public static final long FIELD_TYPE_FLOAT = 8589934592L; // 0x200000000L
    field public static final long FIELD_TYPE_INT32 = 21474836480L; // 0x500000000L
    field public static final long FIELD_TYPE_INT64 = 12884901888L; // 0x300000000L
    field public static final long FIELD_TYPE_MASK = 1095216660480L; // 0xff00000000L
    field public static final long FIELD_TYPE_MESSAGE = 47244640256L; // 0xb00000000L
    field public static final long FIELD_TYPE_SFIXED32 = 64424509440L; // 0xf00000000L
    field public static final long FIELD_TYPE_SFIXED64 = 68719476736L; // 0x1000000000L
    field public static final int FIELD_TYPE_SHIFT = 32; // 0x20
    field public static final long FIELD_TYPE_SINT32 = 73014444032L; // 0x1100000000L
    field public static final long FIELD_TYPE_SINT64 = 77309411328L; // 0x1200000000L
    field public static final long FIELD_TYPE_STRING = 38654705664L; // 0x900000000L
    field public static final long FIELD_TYPE_UINT32 = 55834574848L; // 0xd00000000L
    field public static final long FIELD_TYPE_UINT64 = 17179869184L; // 0x400000000L
    field public static final long FIELD_TYPE_UNKNOWN = 0L; // 0x0L
    field public static final java.lang.String TAG = "ProtoOutputStream";
    field public static final int WIRE_TYPE_END_GROUP = 4; // 0x4
    field public static final int WIRE_TYPE_FIXED32 = 5; // 0x5
    field public static final int WIRE_TYPE_FIXED64 = 1; // 0x1
    field public static final int WIRE_TYPE_LENGTH_DELIMITED = 2; // 0x2
    field public static final int WIRE_TYPE_MASK = 7; // 0x7
    field public static final int WIRE_TYPE_START_GROUP = 3; // 0x3
    field public static final int WIRE_TYPE_VARINT = 0; // 0x0
  }

  public class ProtoParseException extends java.lang.RuntimeException {
    ctor public ProtoParseException(java.lang.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, java.lang.Runnable, java.lang.Object);
    method public void postCallbackDelayed(int, java.lang.Runnable, java.lang.Object, long);
    method public void removeCallbacks(int, java.lang.Runnable, java.lang.Object);
    method public static void setFrameDelay(long);
    field public static final int CALLBACK_ANIMATION = 1; // 0x1
  }

  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 public void disable();
    method public void enable();
  }

  public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public static java.lang.String actionToString(int);
    field public static final int LAST_KEYCODE = 285; // 0x11d
  }

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

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

  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 static boolean isDefaultFocusHighlightEnabled();
    method public boolean isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
    method public boolean restoreFocusInCluster(int);
    method public boolean restoreFocusNotInCluster();
    method public void setAutofilled(boolean);
    method public final void setFocusedInCluster();
  }

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

  public final class ViewTreeObserver {
    method public void registerFrameCommitCallback(java.lang.Runnable);
    method public boolean unregisterFrameCommitCallback(java.lang.Runnable);
  }

  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 java.lang.CharSequence accessibilityTitle;
    field public int privateFlags;
  }

}

package android.view.accessibility {

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

  public 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(android.view.autofill.AutofillId, int);
  }

}

package android.view.inputmethod {

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

}

package android.widget {

  public abstract class AbsListView extends android.widget.AdapterView 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 public int getMode();
    field public static final int MODE_CALENDAR = 2; // 0x2
    field public static final int MODE_SPINNER = 1; // 0x1
  }

  public final class Magnifier {
    method public android.graphics.Bitmap getContent();
    method public static android.graphics.PointF getMagnifierDefaultSize();
    method public android.graphics.Rect getWindowPositionOnScreen();
    method public void setOnOperationCompleteCallback(android.widget.Magnifier.Callback);
  }

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

  public class NumberPicker extends android.widget.LinearLayout {
    method public java.lang.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();
  }

  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 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 public android.view.View getNavigationView();
  }

}

