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

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

  public abstract class PackageManager {
    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 boolean isPermissionReviewModeEnabled();
    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
  }

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

  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 PowerManager {
    method public void nap(long);
  }

  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 setViolationLogger(android.os.StrictMode.ViolationLogger);
  }

  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, 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 protected static int scale(int, float, int);
    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;
  }

}

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

}

