package android {

  public static final class Manifest.permission {
    field public static final java.lang.String ACCESS_AMBIENT_LIGHT_STATS = "android.permission.ACCESS_AMBIENT_LIGHT_STATS";
    field public static final java.lang.String ACCESS_BROADCAST_RADIO = "android.permission.ACCESS_BROADCAST_RADIO";
    field public static final java.lang.String ACCESS_CACHE_FILESYSTEM = "android.permission.ACCESS_CACHE_FILESYSTEM";
    field public static final java.lang.String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES";
    field public static final java.lang.String ACCESS_DRM_CERTIFICATES = "android.permission.ACCESS_DRM_CERTIFICATES";
    field public static final deprecated java.lang.String ACCESS_FM_RADIO = "android.permission.ACCESS_FM_RADIO";
    field public static final java.lang.String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION";
    field public static final java.lang.String ACCESS_MTP = "android.permission.ACCESS_MTP";
    field public static final java.lang.String ACCESS_NETWORK_CONDITIONS = "android.permission.ACCESS_NETWORK_CONDITIONS";
    field public static final java.lang.String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
    field public static final java.lang.String ACCESS_SHORTCUTS = "android.permission.ACCESS_SHORTCUTS";
    field public static final java.lang.String ACCESS_SURFACE_FLINGER = "android.permission.ACCESS_SURFACE_FLINGER";
    field public static final java.lang.String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER";
    field public static final java.lang.String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
    field public static final java.lang.String ALLOCATE_AGGRESSIVE = "android.permission.ALLOCATE_AGGRESSIVE";
    field public static final java.lang.String ALLOW_ANY_CODEC_FOR_PLAYBACK = "android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK";
    field public static final java.lang.String BACKUP = "android.permission.BACKUP";
    field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
    field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
    field public static final deprecated java.lang.String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE";
    field public static final java.lang.String BIND_DIRECTORY_SEARCH = "android.permission.BIND_DIRECTORY_SEARCH";
    field public static final java.lang.String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
    field public static final java.lang.String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE";
    field public static final java.lang.String BIND_KEYGUARD_APPWIDGET = "android.permission.BIND_KEYGUARD_APPWIDGET";
    field public static final java.lang.String BIND_NETWORK_RECOMMENDATION_SERVICE = "android.permission.BIND_NETWORK_RECOMMENDATION_SERVICE";
    field public static final java.lang.String BIND_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
    field public static final java.lang.String BIND_PRINT_RECOMMENDATION_SERVICE = "android.permission.BIND_PRINT_RECOMMENDATION_SERVICE";
    field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
    field public static final java.lang.String BIND_RESOLVER_RANKER_SERVICE = "android.permission.BIND_RESOLVER_RANKER_SERVICE";
    field public static final java.lang.String BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE = "android.permission.BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE";
    field public static final java.lang.String BIND_SETTINGS_SUGGESTIONS_SERVICE = "android.permission.BIND_SETTINGS_SUGGESTIONS_SERVICE";
    field public static final java.lang.String BIND_SOUND_TRIGGER_DETECTION_SERVICE = "android.permission.BIND_SOUND_TRIGGER_DETECTION_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_DATA_SERVICE = "android.permission.BIND_TELEPHONY_DATA_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_NETWORK_SERVICE = "android.permission.BIND_TELEPHONY_NETWORK_SERVICE";
    field public static final java.lang.String BIND_TEXTCLASSIFIER_SERVICE = "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
    field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
    field public static final java.lang.String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE";
    field public static final java.lang.String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
    field public static final java.lang.String BRICK = "android.permission.BRICK";
    field public static final java.lang.String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
    field public static final deprecated java.lang.String BROADCAST_NETWORK_PRIVILEGED = "android.permission.BROADCAST_NETWORK_PRIVILEGED";
    field public static final java.lang.String CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED";
    field public static final java.lang.String CAMERA_DISABLE_TRANSMIT_LED = "android.permission.CAMERA_DISABLE_TRANSMIT_LED";
    field public static final java.lang.String CAPTURE_AUDIO_HOTWORD = "android.permission.CAPTURE_AUDIO_HOTWORD";
    field public static final java.lang.String CAPTURE_AUDIO_OUTPUT = "android.permission.CAPTURE_AUDIO_OUTPUT";
    field public static final java.lang.String CAPTURE_SECURE_VIDEO_OUTPUT = "android.permission.CAPTURE_SECURE_VIDEO_OUTPUT";
    field public static final java.lang.String CAPTURE_TV_INPUT = "android.permission.CAPTURE_TV_INPUT";
    field public static final java.lang.String CAPTURE_VIDEO_OUTPUT = "android.permission.CAPTURE_VIDEO_OUTPUT";
    field public static final java.lang.String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
    field public static final java.lang.String CHANGE_COMPONENT_ENABLED_STATE = "android.permission.CHANGE_COMPONENT_ENABLED_STATE";
    field public static final java.lang.String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION";
    field public static final java.lang.String CHANGE_DEVICE_IDLE_TEMP_WHITELIST = "android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST";
    field public static final java.lang.String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA";
    field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final java.lang.String CONNECTIVITY_INTERNAL = "android.permission.CONNECTIVITY_INTERNAL";
    field public static final java.lang.String CONNECTIVITY_USE_RESTRICTED_NETWORKS = "android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS";
    field public static final java.lang.String CONTROL_DISPLAY_SATURATION = "android.permission.CONTROL_DISPLAY_SATURATION";
    field public static final java.lang.String CONTROL_INCALL_EXPERIENCE = "android.permission.CONTROL_INCALL_EXPERIENCE";
    field public static final java.lang.String CONTROL_LOCATION_UPDATES = "android.permission.CONTROL_LOCATION_UPDATES";
    field public static final java.lang.String CONTROL_VPN = "android.permission.CONTROL_VPN";
    field public static final java.lang.String CRYPT_KEEPER = "android.permission.CRYPT_KEEPER";
    field public static final java.lang.String DELETE_CACHE_FILES = "android.permission.DELETE_CACHE_FILES";
    field public static final java.lang.String DELETE_PACKAGES = "android.permission.DELETE_PACKAGES";
    field public static final java.lang.String DEVICE_POWER = "android.permission.DEVICE_POWER";
    field public static final java.lang.String DIAGNOSTIC = "android.permission.DIAGNOSTIC";
    field public static final java.lang.String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE";
    field public static final java.lang.String DUMP = "android.permission.DUMP";
    field public static final java.lang.String FORCE_BACK = "android.permission.FORCE_BACK";
    field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final java.lang.String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED";
    field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
    field public static final java.lang.String GET_PROCESS_STATE_AND_OOM_SCORE = "android.permission.GET_PROCESS_STATE_AND_OOM_SCORE";
    field public static final java.lang.String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO";
    field public static final java.lang.String GLOBAL_SEARCH = "android.permission.GLOBAL_SEARCH";
    field public static final java.lang.String GRANT_RUNTIME_PERMISSIONS = "android.permission.GRANT_RUNTIME_PERMISSIONS";
    field public static final java.lang.String HARDWARE_TEST = "android.permission.HARDWARE_TEST";
    field public static final java.lang.String HDMI_CEC = "android.permission.HDMI_CEC";
    field public static final java.lang.String HIDE_NON_SYSTEM_OVERLAY_WINDOWS = "android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS";
    field public static final java.lang.String INJECT_EVENTS = "android.permission.INJECT_EVENTS";
    field public static final java.lang.String INSTALL_GRANT_RUNTIME_PERMISSIONS = "android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS";
    field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER";
    field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES";
    field public static final java.lang.String INSTALL_PACKAGE_UPDATES = "android.permission.INSTALL_PACKAGE_UPDATES";
    field public static final java.lang.String INSTALL_SELF_UPDATES = "android.permission.INSTALL_SELF_UPDATES";
    field public static final java.lang.String INTENT_FILTER_VERIFICATION_AGENT = "android.permission.INTENT_FILTER_VERIFICATION_AGENT";
    field public static final java.lang.String INTERACT_ACROSS_USERS = "android.permission.INTERACT_ACROSS_USERS";
    field public static final java.lang.String INTERACT_ACROSS_USERS_FULL = "android.permission.INTERACT_ACROSS_USERS_FULL";
    field public static final java.lang.String INTERNAL_SYSTEM_WINDOW = "android.permission.INTERNAL_SYSTEM_WINDOW";
    field public static final java.lang.String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP";
    field public static final java.lang.String KILL_UID = "android.permission.KILL_UID";
    field public static final java.lang.String LOCAL_MAC_ADDRESS = "android.permission.LOCAL_MAC_ADDRESS";
    field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
    field public static final java.lang.String LOOP_RADIO = "android.permission.LOOP_RADIO";
    field public static final java.lang.String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
    field public static final java.lang.String MANAGE_APP_OPS_RESTRICTIONS = "android.permission.MANAGE_APP_OPS_RESTRICTIONS";
    field public static final java.lang.String MANAGE_APP_TOKENS = "android.permission.MANAGE_APP_TOKENS";
    field public static final java.lang.String MANAGE_AUTO_FILL = "android.permission.MANAGE_AUTO_FILL";
    field public static final java.lang.String MANAGE_CARRIER_OEM_UNLOCK_STATE = "android.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE";
    field public static final java.lang.String MANAGE_CA_CERTIFICATES = "android.permission.MANAGE_CA_CERTIFICATES";
    field public static final java.lang.String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS";
    field public static final java.lang.String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
    field public static final java.lang.String MANAGE_SOUND_TRIGGER = "android.permission.MANAGE_SOUND_TRIGGER";
    field public static final java.lang.String MANAGE_SUBSCRIPTION_PLANS = "android.permission.MANAGE_SUBSCRIPTION_PLANS";
    field public static final java.lang.String MANAGE_USB = "android.permission.MANAGE_USB";
    field public static final java.lang.String MANAGE_USERS = "android.permission.MANAGE_USERS";
    field public static final java.lang.String MANAGE_USER_OEM_UNLOCK_STATE = "android.permission.MANAGE_USER_OEM_UNLOCK_STATE";
    field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
    field public static final java.lang.String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
    field public static final java.lang.String MODIFY_APPWIDGET_BIND_PERMISSIONS = "android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS";
    field public static final java.lang.String MODIFY_AUDIO_ROUTING = "android.permission.MODIFY_AUDIO_ROUTING";
    field public static final java.lang.String MODIFY_CELL_BROADCASTS = "android.permission.MODIFY_CELL_BROADCASTS";
    field public static final java.lang.String MODIFY_DAY_NIGHT_MODE = "android.permission.MODIFY_DAY_NIGHT_MODE";
    field public static final deprecated java.lang.String MODIFY_NETWORK_ACCOUNTING = "android.permission.MODIFY_NETWORK_ACCOUNTING";
    field public static final java.lang.String MODIFY_PARENTAL_CONTROLS = "android.permission.MODIFY_PARENTAL_CONTROLS";
    field public static final java.lang.String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
    field public static final java.lang.String MODIFY_QUIET_MODE = "android.permission.MODIFY_QUIET_MODE";
    field public static final java.lang.String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS";
    field public static final java.lang.String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS";
    field public static final java.lang.String MOVE_PACKAGE = "android.permission.MOVE_PACKAGE";
    field public static final java.lang.String NOTIFICATION_DURING_SETUP = "android.permission.NOTIFICATION_DURING_SETUP";
    field public static final java.lang.String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";
    field public static final java.lang.String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE";
    field public static final java.lang.String OVERRIDE_WIFI_CONFIG = "android.permission.OVERRIDE_WIFI_CONFIG";
    field public static final java.lang.String PACKAGE_USAGE_STATS = "android.permission.PACKAGE_USAGE_STATS";
    field public static final java.lang.String PACKAGE_VERIFICATION_AGENT = "android.permission.PACKAGE_VERIFICATION_AGENT";
    field public static final java.lang.String PEERS_MAC_ADDRESS = "android.permission.PEERS_MAC_ADDRESS";
    field public static final java.lang.String PERFORM_CDMA_PROVISIONING = "android.permission.PERFORM_CDMA_PROVISIONING";
    field public static final java.lang.String PERFORM_SIM_ACTIVATION = "android.permission.PERFORM_SIM_ACTIVATION";
    field public static final java.lang.String PROVIDE_RESOLVER_RANKER_SERVICE = "android.permission.PROVIDE_RESOLVER_RANKER_SERVICE";
    field public static final java.lang.String PROVIDE_TRUST_AGENT = "android.permission.PROVIDE_TRUST_AGENT";
    field public static final java.lang.String QUERY_TIME_ZONE_RULES = "android.permission.QUERY_TIME_ZONE_RULES";
    field public static final java.lang.String READ_CONTENT_RATING_SYSTEMS = "android.permission.READ_CONTENT_RATING_SYSTEMS";
    field public static final java.lang.String READ_DREAM_STATE = "android.permission.READ_DREAM_STATE";
    field public static final java.lang.String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER";
    field public static final java.lang.String READ_INSTALL_SESSIONS = "android.permission.READ_INSTALL_SESSIONS";
    field public static final java.lang.String READ_LOGS = "android.permission.READ_LOGS";
    field public static final java.lang.String READ_NETWORK_USAGE_HISTORY = "android.permission.READ_NETWORK_USAGE_HISTORY";
    field public static final java.lang.String READ_OEM_UNLOCK_STATE = "android.permission.READ_OEM_UNLOCK_STATE";
    field public static final java.lang.String READ_PRINT_SERVICES = "android.permission.READ_PRINT_SERVICES";
    field public static final java.lang.String READ_PRINT_SERVICE_RECOMMENDATIONS = "android.permission.READ_PRINT_SERVICE_RECOMMENDATIONS";
    field public static final java.lang.String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
    field public static final java.lang.String READ_RUNTIME_PROFILES = "android.permission.READ_RUNTIME_PROFILES";
    field public static final java.lang.String READ_SEARCH_INDEXABLES = "android.permission.READ_SEARCH_INDEXABLES";
    field public static final java.lang.String READ_SYSTEM_UPDATE_INFO = "android.permission.READ_SYSTEM_UPDATE_INFO";
    field public static final java.lang.String READ_WALLPAPER_INTERNAL = "android.permission.READ_WALLPAPER_INTERNAL";
    field public static final java.lang.String READ_WIFI_CREDENTIAL = "android.permission.READ_WIFI_CREDENTIAL";
    field public static final java.lang.String REAL_GET_TASKS = "android.permission.REAL_GET_TASKS";
    field public static final java.lang.String REBOOT = "android.permission.REBOOT";
    field public static final java.lang.String RECEIVE_DATA_ACTIVITY_CHANGE = "android.permission.RECEIVE_DATA_ACTIVITY_CHANGE";
    field public static final java.lang.String RECEIVE_EMERGENCY_BROADCAST = "android.permission.RECEIVE_EMERGENCY_BROADCAST";
    field public static final java.lang.String RECEIVE_WIFI_CREDENTIAL_CHANGE = "android.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE";
    field public static final java.lang.String RECOVERY = "android.permission.RECOVERY";
    field public static final java.lang.String RECOVER_KEYSTORE = "android.permission.RECOVER_KEYSTORE";
    field public static final java.lang.String REGISTER_CALL_PROVIDER = "android.permission.REGISTER_CALL_PROVIDER";
    field public static final java.lang.String REGISTER_CONNECTION_MANAGER = "android.permission.REGISTER_CONNECTION_MANAGER";
    field public static final java.lang.String REGISTER_SIM_SUBSCRIPTION = "android.permission.REGISTER_SIM_SUBSCRIPTION";
    field public static final java.lang.String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
    field public static final java.lang.String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
    field public static final java.lang.String RETRIEVE_WINDOW_CONTENT = "android.permission.RETRIEVE_WINDOW_CONTENT";
    field public static final java.lang.String REVOKE_RUNTIME_PERMISSIONS = "android.permission.REVOKE_RUNTIME_PERMISSIONS";
    field public static final java.lang.String SCORE_NETWORKS = "android.permission.SCORE_NETWORKS";
    field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
    field public static final java.lang.String SEND_SHOW_SUSPENDED_APP_DETAILS = "android.permission.SEND_SHOW_SUSPENDED_APP_DETAILS";
    field public static final java.lang.String SEND_SMS_NO_CONFIRMATION = "android.permission.SEND_SMS_NO_CONFIRMATION";
    field public static final java.lang.String SERIAL_PORT = "android.permission.SERIAL_PORT";
    field public static final java.lang.String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
    field public static final java.lang.String SET_ALWAYS_FINISH = "android.permission.SET_ALWAYS_FINISH";
    field public static final java.lang.String SET_ANIMATION_SCALE = "android.permission.SET_ANIMATION_SCALE";
    field public static final java.lang.String SET_DEBUG_APP = "android.permission.SET_DEBUG_APP";
    field public static final java.lang.String SET_HARMFUL_APP_WARNINGS = "android.permission.SET_HARMFUL_APP_WARNINGS";
    field public static final java.lang.String SET_MEDIA_KEY_LISTENER = "android.permission.SET_MEDIA_KEY_LISTENER";
    field public static final java.lang.String SET_ORIENTATION = "android.permission.SET_ORIENTATION";
    field public static final java.lang.String SET_POINTER_SPEED = "android.permission.SET_POINTER_SPEED";
    field public static final java.lang.String SET_PROCESS_LIMIT = "android.permission.SET_PROCESS_LIMIT";
    field public static final java.lang.String SET_SCREEN_COMPATIBILITY = "android.permission.SET_SCREEN_COMPATIBILITY";
    field public static final java.lang.String SET_TIME = "android.permission.SET_TIME";
    field public static final java.lang.String SET_VOLUME_KEY_LONG_PRESS_LISTENER = "android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER";
    field public static final java.lang.String SET_WALLPAPER_COMPONENT = "android.permission.SET_WALLPAPER_COMPONENT";
    field public static final java.lang.String SHOW_KEYGUARD_MESSAGE = "android.permission.SHOW_KEYGUARD_MESSAGE";
    field public static final java.lang.String SHUTDOWN = "android.permission.SHUTDOWN";
    field public static final java.lang.String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES";
    field public static final java.lang.String STATUS_BAR = "android.permission.STATUS_BAR";
    field public static final java.lang.String STOP_APP_SWITCHES = "android.permission.STOP_APP_SWITCHES";
    field public static final java.lang.String SUBSTITUTE_NOTIFICATION_APP_NAME = "android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME";
    field public static final java.lang.String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
    field public static final java.lang.String TETHER_PRIVILEGED = "android.permission.TETHER_PRIVILEGED";
    field public static final java.lang.String TV_INPUT_HARDWARE = "android.permission.TV_INPUT_HARDWARE";
    field public static final java.lang.String TV_VIRTUAL_REMOTE_CONTROLLER = "android.permission.TV_VIRTUAL_REMOTE_CONTROLLER";
    field public static final java.lang.String UNLIMITED_SHORTCUTS_API_CALLS = "android.permission.UNLIMITED_SHORTCUTS_API_CALLS";
    field public static final java.lang.String UPDATE_APP_OPS_STATS = "android.permission.UPDATE_APP_OPS_STATS";
    field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
    field public static final java.lang.String UPDATE_LOCK = "android.permission.UPDATE_LOCK";
    field public static final java.lang.String UPDATE_TIME_ZONE_RULES = "android.permission.UPDATE_TIME_ZONE_RULES";
    field public static final java.lang.String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
    field public static final java.lang.String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK";
    field public static final java.lang.String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS";
    field public static final java.lang.String WRITE_DREAM_STATE = "android.permission.WRITE_DREAM_STATE";
    field public static final java.lang.String WRITE_EMBEDDED_SUBSCRIPTIONS = "android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS";
    field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
    field public static final java.lang.String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE";
    field public static final java.lang.String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS";
  }

  public static final class R.array {
    field public static final int config_keySystemUuidMapping = 17235973; // 0x1070005
  }

  public static final class R.attr {
    field public static final int isVrOnly = 16844152; // 0x1010578
    field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
    field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566
    field public static final int userRestriction = 16844164; // 0x1010584
  }

  public static final class R.raw {
    field public static final int loaderror = 17825792; // 0x1100000
    field public static final int nodomain = 17825793; // 0x1100001
  }

  public static final class R.style {
    field public static final int Theme_Leanback_FormWizard = 16974544; // 0x10302d0
  }

}

package android.accounts {

  public class AccountManager {
    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSessionAsUser(android.os.Bundle, android.app.Activity, android.os.UserHandle, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
  }

}

package android.app {

  public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
    method public void convertFromTranslucent();
    method public boolean convertToTranslucent(android.app.Activity.TranslucentConversionListener, android.app.ActivityOptions);
    method public deprecated boolean isBackgroundVisibleBehind();
    method public deprecated void onBackgroundVisibleBehindChanged(boolean);
  }

  public static abstract interface Activity.TranslucentConversionListener {
    method public abstract void onTranslucentConversionComplete(boolean);
  }

  public class ActivityManager {
    method public void addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int);
    method public void forceStopPackage(java.lang.String);
    method public static int getCurrentUser();
    method public int getPackageImportance(java.lang.String);
    method public int getUidImportance(int);
    method public void killUid(int, java.lang.String);
    method public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method public static void setPersistentVrThread(int);
  }

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

  public class AlarmManager {
    method public void set(int, long, long, long, android.app.PendingIntent, android.os.WorkSource);
    method public void set(int, long, long, long, android.app.AlarmManager.OnAlarmListener, android.os.Handler, android.os.WorkSource);
  }

  public class AppOpsManager {
    method public static java.lang.String[] getOpStrs();
    method public java.util.List<android.app.AppOpsManager.PackageOps> getOpsForPackage(int, java.lang.String, int[]);
    method public void setMode(java.lang.String, int, java.lang.String, int);
    method public void setUidMode(java.lang.String, int, int);
    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";
  }

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

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

  public class BroadcastOptions {
    method public static android.app.BroadcastOptions makeBasic();
    method public void setDontSendToRestrictedApps(boolean);
    method public void setTemporaryAppWhitelistDuration(long);
    method public android.os.Bundle toBundle();
  }

  public class DownloadManager {
    field public static final java.lang.String ACTION_DOWNLOAD_COMPLETED = "android.intent.action.DOWNLOAD_COMPLETED";
  }

  public abstract class InstantAppResolverService extends android.app.Service {
    ctor public InstantAppResolverService();
    method public final void attachBaseContext(android.content.Context);
    method public final android.os.IBinder onBind(android.content.Intent);
    method public deprecated void onGetInstantAppIntentFilter(int[], java.lang.String, android.app.InstantAppResolverService.InstantAppResolutionCallback);
    method public void onGetInstantAppIntentFilter(android.content.Intent, int[], java.lang.String, android.app.InstantAppResolverService.InstantAppResolutionCallback);
    method public deprecated void onGetInstantAppResolveInfo(int[], java.lang.String, android.app.InstantAppResolverService.InstantAppResolutionCallback);
    method public void onGetInstantAppResolveInfo(android.content.Intent, int[], java.lang.String, android.app.InstantAppResolverService.InstantAppResolutionCallback);
  }

  public static final class InstantAppResolverService.InstantAppResolutionCallback {
    method public void onInstantAppResolveInfo(java.util.List<android.content.pm.InstantAppResolveInfo>);
  }

  public class KeyguardManager {
    method public android.content.Intent createConfirmFactoryResetCredentialIntent(java.lang.CharSequence, java.lang.CharSequence, java.lang.CharSequence);
    method public void requestDismissKeyguard(android.app.Activity, java.lang.CharSequence, android.app.KeyguardManager.KeyguardDismissCallback);
  }

  public class Notification implements android.os.Parcelable {
    field public static final java.lang.String CATEGORY_CAR_EMERGENCY = "car_emergency";
    field public static final java.lang.String CATEGORY_CAR_INFORMATION = "car_information";
    field public static final java.lang.String CATEGORY_CAR_WARNING = "car_warning";
    field public static final java.lang.String EXTRA_ALLOW_DURING_SETUP = "android.allowDuringSetup";
    field public static final java.lang.String EXTRA_SUBSTITUTE_APP_NAME = "android.substName";
    field public static final int FLAG_AUTOGROUP_SUMMARY = 1024; // 0x400
  }

  public static final class Notification.TvExtender implements android.app.Notification.Extender {
    ctor public Notification.TvExtender();
    ctor public Notification.TvExtender(android.app.Notification);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.lang.String getChannelId();
    method public android.app.PendingIntent getContentIntent();
    method public android.app.PendingIntent getDeleteIntent();
    method public boolean getSuppressShowOverApps();
    method public boolean isAvailableOnTv();
    method public android.app.Notification.TvExtender setChannel(java.lang.String);
    method public android.app.Notification.TvExtender setChannelId(java.lang.String);
    method public android.app.Notification.TvExtender setContentIntent(android.app.PendingIntent);
    method public android.app.Notification.TvExtender setDeleteIntent(android.app.PendingIntent);
    method public android.app.Notification.TvExtender setSuppressShowOverApps(boolean);
  }

  public final class NotificationChannel implements android.os.Parcelable {
    method public int getUserLockedFields();
    method public boolean isDeleted();
    method public void populateFromXml(org.xmlpull.v1.XmlPullParser);
    method public org.json.JSONObject toJson() throws org.json.JSONException;
    method public void writeXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
  }

  public final class NotificationChannelGroup implements android.os.Parcelable {
    method public org.json.JSONObject toJson() throws org.json.JSONException;
  }

  public final class StatsManager {
    method public void addConfig(long, byte[]) throws android.app.StatsManager.StatsUnavailableException;
    method public deprecated boolean addConfiguration(long, byte[]);
    method public deprecated byte[] getData(long);
    method public deprecated byte[] getMetadata();
    method public byte[] getReports(long) throws android.app.StatsManager.StatsUnavailableException;
    method public byte[] getStatsMetadata() throws android.app.StatsManager.StatsUnavailableException;
    method public void removeConfig(long) throws android.app.StatsManager.StatsUnavailableException;
    method public deprecated boolean removeConfiguration(long);
    method public void setBroadcastSubscriber(android.app.PendingIntent, long, long) throws android.app.StatsManager.StatsUnavailableException;
    method public deprecated boolean setBroadcastSubscriber(long, long, android.app.PendingIntent);
    method public deprecated boolean setDataFetchOperation(long, android.app.PendingIntent);
    method public void setFetchReportsOperation(android.app.PendingIntent, long) throws android.app.StatsManager.StatsUnavailableException;
    field public static final java.lang.String ACTION_STATSD_STARTED = "android.app.action.STATSD_STARTED";
    field public static final java.lang.String EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES = "android.app.extra.STATS_BROADCAST_SUBSCRIBER_COOKIES";
    field public static final java.lang.String EXTRA_STATS_CONFIG_KEY = "android.app.extra.STATS_CONFIG_KEY";
    field public static final java.lang.String EXTRA_STATS_CONFIG_UID = "android.app.extra.STATS_CONFIG_UID";
    field public static final java.lang.String EXTRA_STATS_DIMENSIONS_VALUE = "android.app.extra.STATS_DIMENSIONS_VALUE";
    field public static final java.lang.String EXTRA_STATS_SUBSCRIPTION_ID = "android.app.extra.STATS_SUBSCRIPTION_ID";
    field public static final java.lang.String EXTRA_STATS_SUBSCRIPTION_RULE_ID = "android.app.extra.STATS_SUBSCRIPTION_RULE_ID";
  }

  public static class StatsManager.StatsUnavailableException extends android.util.AndroidException {
    ctor public StatsManager.StatsUnavailableException(java.lang.String);
    ctor public StatsManager.StatsUnavailableException(java.lang.String, java.lang.Throwable);
  }

  public final class Vr2dDisplayProperties implements android.os.Parcelable {
    ctor public Vr2dDisplayProperties(int, int, int);
    method public int describeContents();
    method public void dump(java.io.PrintWriter, java.lang.String);
    method public int getAddedFlags();
    method public int getDpi();
    method public int getHeight();
    method public int getRemovedFlags();
    method public int getWidth();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.Vr2dDisplayProperties> CREATOR;
    field public static final int FLAG_VIRTUAL_DISPLAY_ENABLED = 1; // 0x1
  }

  public static class Vr2dDisplayProperties.Builder {
    ctor public Vr2dDisplayProperties.Builder();
    method public android.app.Vr2dDisplayProperties.Builder addFlags(int);
    method public android.app.Vr2dDisplayProperties build();
    method public android.app.Vr2dDisplayProperties.Builder removeFlags(int);
    method public android.app.Vr2dDisplayProperties.Builder setDimensions(int, int, int);
    method public android.app.Vr2dDisplayProperties.Builder setEnabled(boolean);
  }

  public static abstract class Vr2dDisplayProperties.Vr2dDisplayFlag implements java.lang.annotation.Annotation {
  }

  public class VrManager {
    method public int getVr2dDisplayId();
    method public boolean isPersistentVrModeEnabled();
    method public boolean isVrModeEnabled();
    method public void registerVrStateCallback(java.util.concurrent.Executor, android.app.VrStateCallback);
    method public void setAndBindVrCompositor(android.content.ComponentName);
    method public void setPersistentVrModeEnabled(boolean);
    method public void setStandbyEnabled(boolean);
    method public void setVr2dDisplayProperties(android.app.Vr2dDisplayProperties);
    method public void setVrInputMethod(android.content.ComponentName);
    method public void unregisterVrStateCallback(android.app.VrStateCallback);
  }

  public abstract class VrStateCallback {
    ctor public VrStateCallback();
    method public void onPersistentVrStateChanged(boolean);
    method public void onVrStateChanged(boolean);
  }

  public class WallpaperManager {
    method public void clearWallpaper(int, int);
    method public void setDisplayOffset(android.os.IBinder, int, int);
    method public boolean setWallpaperComponent(android.content.ComponentName);
  }

}

package android.app.admin {

  public class DeviceAdminReceiver extends android.content.BroadcastReceiver {
    method public deprecated void onReadyForUserInitialization(android.content.Context, android.content.Intent);
  }

  public class DevicePolicyManager {
    method public java.lang.String getDeviceOwner();
    method public android.content.ComponentName getDeviceOwnerComponentOnAnyUser();
    method public java.lang.String getDeviceOwnerNameOnAnyUser();
    method public java.lang.CharSequence getDeviceOwnerOrganizationName();
    method public java.util.List<java.lang.String> getPermittedAccessibilityServices(int);
    method public java.util.List<java.lang.String> getPermittedInputMethodsForCurrentUser();
    method public android.content.ComponentName getProfileOwner() throws java.lang.IllegalArgumentException;
    method public java.lang.String getProfileOwnerNameAsUser(int) throws java.lang.IllegalArgumentException;
    method public int getUserProvisioningState();
    method public boolean isDeviceManaged();
    method public boolean isDeviceProvisioned();
    method public boolean isDeviceProvisioningConfigApplied();
    method public void notifyPendingSystemUpdate(long);
    method public void notifyPendingSystemUpdate(long, boolean);
    method public boolean packageHasActiveAdmins(java.lang.String);
    method public deprecated boolean setActiveProfileOwner(android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException;
    method public void setDeviceProvisioningConfigApplied();
    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_PROVISION_FINALIZATION = "android.app.action.PROVISION_FINALIZATION";
    field public static final java.lang.String ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = "android.app.action.PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE";
    field public static final java.lang.String ACTION_SET_PROFILE_OWNER = "android.app.action.SET_PROFILE_OWNER";
    field public static final java.lang.String ACTION_STATE_USER_SETUP_COMPLETE = "android.app.action.STATE_USER_SETUP_COMPLETE";
    field public static final java.lang.String EXTRA_PROFILE_OWNER_NAME = "android.app.extra.PROFILE_OWNER_NAME";
    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI";
    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL";
    field public static final java.lang.String EXTRA_PROVISIONING_ORGANIZATION_NAME = "android.app.extra.PROVISIONING_ORGANIZATION_NAME";
    field public static final java.lang.String EXTRA_PROVISIONING_SUPPORT_URL = "android.app.extra.PROVISIONING_SUPPORT_URL";
    field public static final int STATE_USER_PROFILE_COMPLETE = 4; // 0x4
    field public static final int STATE_USER_SETUP_COMPLETE = 2; // 0x2
    field public static final int STATE_USER_SETUP_FINALIZED = 3; // 0x3
    field public static final int STATE_USER_SETUP_INCOMPLETE = 1; // 0x1
    field public static final int STATE_USER_UNMANAGED = 0; // 0x0
  }

  public final class SystemUpdatePolicy implements android.os.Parcelable {
    method public int describeContents();
    method public android.app.admin.SystemUpdatePolicy.InstallationOption getInstallationOptionAt(long);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy> CREATOR;
    field public static final int TYPE_PAUSE = 4; // 0x4
  }

  public static class SystemUpdatePolicy.InstallationOption {
    method public long getEffectiveTime();
    method public int getType();
  }

}

package android.app.backup {

  public class BackupDataInput {
    ctor public BackupDataInput(java.io.FileDescriptor);
  }

  public class BackupDataOutput {
    ctor public BackupDataOutput(java.io.FileDescriptor);
    ctor public BackupDataOutput(java.io.FileDescriptor, long);
  }

  public class BackupManager {
    method public void backupNow();
    method public android.app.backup.RestoreSession beginRestoreSession();
    method public void cancelBackups();
    method public long getAvailableRestoreToken(java.lang.String);
    method public android.content.Intent getConfigurationIntent(java.lang.String);
    method public java.lang.String getCurrentTransport();
    method public android.content.ComponentName getCurrentTransportComponent();
    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);
    method public boolean isAppEligibleForBackup(java.lang.String);
    method public boolean isBackupEnabled();
    method public boolean isBackupServiceActive(android.os.UserHandle);
    method public java.lang.String[] listAllTransports();
    method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver);
    method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver, android.app.backup.BackupManagerMonitor, int);
    method public deprecated int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public deprecated java.lang.String selectBackupTransport(java.lang.String);
    method public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback);
    method public void setAutoRestore(boolean);
    method public void setBackupEnabled(boolean);
    method public void updateTransportAttributes(android.content.ComponentName, java.lang.String, android.content.Intent, java.lang.String, android.content.Intent, java.lang.String);
    field public static final int ERROR_AGENT_FAILURE = -1003; // 0xfffffc15
    field public static final int ERROR_BACKUP_CANCELLED = -2003; // 0xfffff82d
    field public static final int ERROR_BACKUP_NOT_ALLOWED = -2001; // 0xfffff82f
    field public static final int ERROR_PACKAGE_NOT_FOUND = -2002; // 0xfffff82e
    field public static final int ERROR_TRANSPORT_ABORTED = -1000; // 0xfffffc18
    field public static final int ERROR_TRANSPORT_INVALID = -2; // 0xfffffffe
    field public static final int ERROR_TRANSPORT_PACKAGE_REJECTED = -1002; // 0xfffffc16
    field public static final int ERROR_TRANSPORT_QUOTA_EXCEEDED = -1005; // 0xfffffc13
    field public static final int ERROR_TRANSPORT_UNAVAILABLE = -1; // 0xffffffff
    field public static final int FLAG_NON_INCREMENTAL_BACKUP = 1; // 0x1
    field public static final java.lang.String PACKAGE_MANAGER_SENTINEL = "@pm@";
    field public static final int SUCCESS = 0; // 0x0
  }

  public class BackupManagerMonitor {
    ctor public BackupManagerMonitor();
    method public void onEvent(android.os.Bundle);
    field public static final java.lang.String EXTRA_LOG_CANCEL_ALL = "android.app.backup.extra.LOG_CANCEL_ALL";
    field public static final java.lang.String EXTRA_LOG_EVENT_CATEGORY = "android.app.backup.extra.LOG_EVENT_CATEGORY";
    field public static final java.lang.String EXTRA_LOG_EVENT_ID = "android.app.backup.extra.LOG_EVENT_ID";
    field public static final java.lang.String EXTRA_LOG_EVENT_PACKAGE_LONG_VERSION = "android.app.backup.extra.LOG_EVENT_PACKAGE_FULL_VERSION";
    field public static final java.lang.String EXTRA_LOG_EVENT_PACKAGE_NAME = "android.app.backup.extra.LOG_EVENT_PACKAGE_NAME";
    field public static final deprecated java.lang.String EXTRA_LOG_EVENT_PACKAGE_VERSION = "android.app.backup.extra.LOG_EVENT_PACKAGE_VERSION";
    field public static final java.lang.String EXTRA_LOG_EXCEPTION_FULL_BACKUP = "android.app.backup.extra.LOG_EXCEPTION_FULL_BACKUP";
    field public static final java.lang.String EXTRA_LOG_ILLEGAL_KEY = "android.app.backup.extra.LOG_ILLEGAL_KEY";
    field public static final java.lang.String EXTRA_LOG_MANIFEST_PACKAGE_NAME = "android.app.backup.extra.LOG_MANIFEST_PACKAGE_NAME";
    field public static final java.lang.String EXTRA_LOG_OLD_VERSION = "android.app.backup.extra.LOG_OLD_VERSION";
    field public static final java.lang.String EXTRA_LOG_POLICY_ALLOW_APKS = "android.app.backup.extra.LOG_POLICY_ALLOW_APKS";
    field public static final java.lang.String EXTRA_LOG_PREFLIGHT_ERROR = "android.app.backup.extra.LOG_PREFLIGHT_ERROR";
    field public static final java.lang.String EXTRA_LOG_RESTORE_ANYWAY = "android.app.backup.extra.LOG_RESTORE_ANYWAY";
    field public static final java.lang.String EXTRA_LOG_RESTORE_VERSION = "android.app.backup.extra.LOG_RESTORE_VERSION";
    field public static final java.lang.String EXTRA_LOG_WIDGET_PACKAGE_NAME = "android.app.backup.extra.LOG_WIDGET_PACKAGE_NAME";
    field public static final int LOG_EVENT_CATEGORY_AGENT = 2; // 0x2
    field public static final int LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY = 3; // 0x3
    field public static final int LOG_EVENT_CATEGORY_TRANSPORT = 1; // 0x1
    field public static final int LOG_EVENT_ID_APK_NOT_INSTALLED = 40; // 0x28
    field public static final int LOG_EVENT_ID_APP_HAS_NO_AGENT = 28; // 0x1c
    field public static final int LOG_EVENT_ID_BACKUP_DISABLED = 13; // 0xd
    field public static final int LOG_EVENT_ID_CANNOT_RESTORE_WITHOUT_APK = 41; // 0x29
    field public static final int LOG_EVENT_ID_CANT_FIND_AGENT = 30; // 0x1e
    field public static final int LOG_EVENT_ID_CORRUPT_MANIFEST = 46; // 0x2e
    field public static final int LOG_EVENT_ID_DEVICE_NOT_PROVISIONED = 14; // 0xe
    field public static final int LOG_EVENT_ID_ERROR_PREFLIGHT = 16; // 0x10
    field public static final int LOG_EVENT_ID_EXCEPTION_FULL_BACKUP = 19; // 0x13
    field public static final int LOG_EVENT_ID_EXPECTED_DIFFERENT_PACKAGE = 43; // 0x2b
    field public static final int LOG_EVENT_ID_FULL_BACKUP_CANCEL = 4; // 0x4
    field public static final int LOG_EVENT_ID_FULL_RESTORE_ALLOW_BACKUP_FALSE = 39; // 0x27
    field public static final int LOG_EVENT_ID_FULL_RESTORE_SIGNATURE_MISMATCH = 37; // 0x25
    field public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; // 0x2d
    field public static final int LOG_EVENT_ID_ILLEGAL_KEY = 5; // 0x5
    field public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_CANCEL = 21; // 0x15
    field public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; // 0x1f
    field public static final int LOG_EVENT_ID_LOST_TRANSPORT = 25; // 0x19
    field public static final int LOG_EVENT_ID_MISSING_SIGNATURE = 42; // 0x2a
    field public static final int LOG_EVENT_ID_NO_DATA_TO_SEND = 7; // 0x7
    field public static final int LOG_EVENT_ID_NO_PACKAGES = 49; // 0x31
    field public static final int LOG_EVENT_ID_NO_PM_METADATA_RECEIVED = 23; // 0x17
    field public static final int LOG_EVENT_ID_NO_RESTORE_METADATA_AVAILABLE = 22; // 0x16
    field public static final int LOG_EVENT_ID_PACKAGE_INELIGIBLE = 9; // 0x9
    field public static final int LOG_EVENT_ID_PACKAGE_KEY_VALUE_PARTICIPANT = 10; // 0xa
    field public static final int LOG_EVENT_ID_PACKAGE_NOT_FOUND = 12; // 0xc
    field public static final int LOG_EVENT_ID_PACKAGE_NOT_PRESENT = 26; // 0x1a
    field public static final int LOG_EVENT_ID_PACKAGE_STOPPED = 11; // 0xb
    field public static final int LOG_EVENT_ID_PACKAGE_TRANSPORT_NOT_PRESENT = 15; // 0xf
    field public static final int LOG_EVENT_ID_PM_AGENT_HAS_NO_METADATA = 24; // 0x18
    field public static final int LOG_EVENT_ID_QUOTA_HIT_PREFLIGHT = 18; // 0x12
    field public static final int LOG_EVENT_ID_RESTORE_ANY_VERSION = 34; // 0x22
    field public static final int LOG_EVENT_ID_RESTORE_VERSION_HIGHER = 27; // 0x1b
    field public static final int LOG_EVENT_ID_SIGNATURE_MISMATCH = 29; // 0x1d
    field public static final int LOG_EVENT_ID_SYSTEM_APP_NO_AGENT = 38; // 0x26
    field public static final int LOG_EVENT_ID_TRANSPORT_IS_NULL = 50; // 0x32
    field public static final int LOG_EVENT_ID_TRANSPORT_NON_INCREMENTAL_BACKUP_REQUIRED = 51; // 0x33
    field public static final int LOG_EVENT_ID_UNKNOWN_VERSION = 44; // 0x2c
    field public static final int LOG_EVENT_ID_VERSIONS_MATCH = 35; // 0x23
    field public static final int LOG_EVENT_ID_VERSION_OF_BACKUP_OLDER = 36; // 0x24
    field public static final int LOG_EVENT_ID_WIDGET_METADATA_MISMATCH = 47; // 0x2f
    field public static final int LOG_EVENT_ID_WIDGET_UNKNOWN_VERSION = 48; // 0x30
  }

  public abstract class BackupObserver {
    ctor public BackupObserver();
    method public void backupFinished(int);
    method public void onResult(java.lang.String, int);
    method public void onUpdate(java.lang.String, android.app.backup.BackupProgress);
  }

  public class BackupProgress implements android.os.Parcelable {
    ctor public BackupProgress(long, long);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.backup.BackupProgress> CREATOR;
    field public final long bytesExpected;
    field public final long bytesTransferred;
  }

  public class BackupTransport {
    ctor public BackupTransport();
    method public int abortFullRestore();
    method public void cancelFullBackup();
    method public int checkFullBackupSize(long);
    method public int clearBackupData(android.content.pm.PackageInfo);
    method public android.content.Intent configurationIntent();
    method public java.lang.String currentDestinationString();
    method public android.content.Intent dataManagementIntent();
    method public java.lang.String dataManagementLabel();
    method public int finishBackup();
    method public void finishRestore();
    method public android.app.backup.RestoreSet[] getAvailableRestoreSets();
    method public long getBackupQuota(java.lang.String, boolean);
    method public android.os.IBinder getBinder();
    method public long getCurrentRestoreSet();
    method public int getNextFullRestoreDataChunk(android.os.ParcelFileDescriptor);
    method public int getRestoreData(android.os.ParcelFileDescriptor);
    method public int getTransportFlags();
    method public int initializeDevice();
    method public boolean isAppEligibleForBackup(android.content.pm.PackageInfo, boolean);
    method public java.lang.String name();
    method public android.app.backup.RestoreDescription nextRestorePackage();
    method public int performBackup(android.content.pm.PackageInfo, android.os.ParcelFileDescriptor, int);
    method public int performBackup(android.content.pm.PackageInfo, android.os.ParcelFileDescriptor);
    method public int performFullBackup(android.content.pm.PackageInfo, android.os.ParcelFileDescriptor, int);
    method public int performFullBackup(android.content.pm.PackageInfo, android.os.ParcelFileDescriptor);
    method public long requestBackupTime();
    method public long requestFullBackupTime();
    method public int sendBackupData(int);
    method public int startRestore(long, android.content.pm.PackageInfo[]);
    method public java.lang.String transportDirName();
    field public static final int AGENT_ERROR = -1003; // 0xfffffc15
    field public static final int AGENT_UNKNOWN = -1004; // 0xfffffc14
    field public static final java.lang.String EXTRA_TRANSPORT_REGISTRATION = "android.app.backup.extra.TRANSPORT_REGISTRATION";
    field public static final int FLAG_INCREMENTAL = 2; // 0x2
    field public static final int FLAG_NON_INCREMENTAL = 4; // 0x4
    field public static final int FLAG_USER_INITIATED = 1; // 0x1
    field public static final int NO_MORE_DATA = -1; // 0xffffffff
    field public static final int TRANSPORT_ERROR = -1000; // 0xfffffc18
    field public static final int TRANSPORT_NON_INCREMENTAL_BACKUP_REQUIRED = -1006; // 0xfffffc12
    field public static final int TRANSPORT_NOT_INITIALIZED = -1001; // 0xfffffc17
    field public static final int TRANSPORT_OK = 0; // 0x0
    field public static final int TRANSPORT_PACKAGE_REJECTED = -1002; // 0xfffffc16
    field public static final int TRANSPORT_QUOTA_EXCEEDED = -1005; // 0xfffffc13
  }

  public class RestoreDescription implements android.os.Parcelable {
    ctor public RestoreDescription(java.lang.String, int);
    method public int describeContents();
    method public int getDataType();
    method public java.lang.String getPackageName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.backup.RestoreDescription> CREATOR;
    field public static final android.app.backup.RestoreDescription NO_MORE_PACKAGES;
    field public static final int TYPE_FULL_STREAM = 2; // 0x2
    field public static final int TYPE_KEY_VALUE = 1; // 0x1
  }

  public abstract class RestoreObserver {
    method public void restoreSetsAvailable(android.app.backup.RestoreSet[]);
  }

  public class RestoreSession {
    method public void endRestoreSession();
    method public int getAvailableRestoreSets(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public int getAvailableRestoreSets(android.app.backup.RestoreObserver);
    method public int restoreAll(long, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public int restoreAll(long, android.app.backup.RestoreObserver);
    method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
    method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver);
  }

  public class RestoreSet implements android.os.Parcelable {
    ctor public RestoreSet();
    ctor public RestoreSet(java.lang.String, java.lang.String, long);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.backup.RestoreSet> CREATOR;
    field public java.lang.String device;
    field public java.lang.String name;
    field public long token;
  }

  public abstract class SelectBackupTransportCallback {
    ctor public SelectBackupTransportCallback();
    method public void onFailure(int);
    method public void onSuccess(java.lang.String);
  }

}

package android.app.job {

  public abstract class JobScheduler {
    method public abstract int scheduleAsPackage(android.app.job.JobInfo, java.lang.String, int, java.lang.String);
  }

}

package android.app.usage {

  public final class CacheQuotaHint implements android.os.Parcelable {
    ctor public CacheQuotaHint(android.app.usage.CacheQuotaHint.Builder);
    method public int describeContents();
    method public long getQuota();
    method public int getUid();
    method public android.app.usage.UsageStats getUsageStats();
    method public java.lang.String getVolumeUuid();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.usage.CacheQuotaHint> CREATOR;
    field public static final long QUOTA_NOT_SET = -1L; // 0xffffffffffffffffL
  }

  public static final class CacheQuotaHint.Builder {
    ctor public CacheQuotaHint.Builder();
    ctor public CacheQuotaHint.Builder(android.app.usage.CacheQuotaHint);
    method public android.app.usage.CacheQuotaHint build();
    method public android.app.usage.CacheQuotaHint.Builder setQuota(long);
    method public android.app.usage.CacheQuotaHint.Builder setUid(int);
    method public android.app.usage.CacheQuotaHint.Builder setUsageStats(android.app.usage.UsageStats);
    method public android.app.usage.CacheQuotaHint.Builder setVolumeUuid(java.lang.String);
  }

  public abstract class CacheQuotaService extends android.app.Service {
    ctor public CacheQuotaService();
    method public android.os.IBinder onBind(android.content.Intent);
    method public abstract java.util.List<android.app.usage.CacheQuotaHint> onComputeCacheQuotaHints(java.util.List<android.app.usage.CacheQuotaHint>);
    field public static final java.lang.String SERVICE_INTERFACE = "android.app.usage.CacheQuotaService";
  }

  public static final class UsageEvents.Event {
    method public java.lang.String getNotificationChannelId();
    field public static final int NOTIFICATION_INTERRUPTION = 12; // 0xc
    field public static final int NOTIFICATION_SEEN = 10; // 0xa
    field public static final int SLICE_PINNED = 14; // 0xe
    field public static final int SLICE_PINNED_PRIV = 13; // 0xd
    field public static final int SYSTEM_INTERACTION = 6; // 0x6
  }

  public final class UsageStats implements android.os.Parcelable {
    method public int getAppLaunchCount();
  }

  public final class UsageStatsManager {
    method public int getAppStandbyBucket(java.lang.String);
    method public java.util.Map<java.lang.String, java.lang.Integer> getAppStandbyBuckets();
    method public void registerAppUsageObserver(int, java.lang.String[], long, java.util.concurrent.TimeUnit, android.app.PendingIntent);
    method public void setAppStandbyBucket(java.lang.String, int);
    method public void setAppStandbyBuckets(java.util.Map<java.lang.String, java.lang.Integer>);
    method public void unregisterAppUsageObserver(int);
    method public void whitelistAppTemporarily(java.lang.String, long, android.os.UserHandle);
    field public static final java.lang.String EXTRA_OBSERVER_ID = "android.app.usage.extra.OBSERVER_ID";
    field public static final java.lang.String EXTRA_TIME_LIMIT = "android.app.usage.extra.TIME_LIMIT";
    field public static final java.lang.String EXTRA_TIME_USED = "android.app.usage.extra.TIME_USED";
    field public static final int STANDBY_BUCKET_EXEMPTED = 5; // 0x5
    field public static final int STANDBY_BUCKET_NEVER = 50; // 0x32
  }

}

package android.bluetooth {

  public final class BluetoothAdapter {
    method public boolean disableBLE();
    method public boolean enableBLE();
    method public boolean enableNoAutoConnect();
    method public boolean isBleScanAlwaysAvailable();
    method public boolean isLeEnabled();
    field public static final java.lang.String ACTION_BLE_STATE_CHANGED = "android.bluetooth.adapter.action.BLE_STATE_CHANGED";
    field public static final java.lang.String ACTION_REQUEST_BLE_SCAN_ALWAYS_AVAILABLE = "android.bluetooth.adapter.action.REQUEST_BLE_SCAN_ALWAYS_AVAILABLE";
  }

  public final class BluetoothDevice implements android.os.Parcelable {
    method public boolean cancelBondProcess();
    method public boolean isConnected();
    method public boolean isEncrypted();
    method public boolean removeBond();
    method public boolean setPhonebookAccessPermission(int);
    field public static final int ACCESS_ALLOWED = 1; // 0x1
    field public static final int ACCESS_REJECTED = 2; // 0x2
    field public static final int ACCESS_UNKNOWN = 0; // 0x0
  }

  public final class BluetoothHeadset implements android.bluetooth.BluetoothProfile {
    method public boolean connect(android.bluetooth.BluetoothDevice);
    method public boolean disconnect(android.bluetooth.BluetoothDevice);
    method public boolean setPriority(android.bluetooth.BluetoothDevice, int);
  }

  public abstract interface BluetoothProfile {
    field public static final int PRIORITY_OFF = 0; // 0x0
    field public static final int PRIORITY_ON = 100; // 0x64
  }

}

package android.bluetooth.le {

  public final class BluetoothLeScanner {
    method public void startScanFromSource(android.os.WorkSource, android.bluetooth.le.ScanCallback);
    method public void startScanFromSource(java.util.List<android.bluetooth.le.ScanFilter>, android.bluetooth.le.ScanSettings, android.os.WorkSource, android.bluetooth.le.ScanCallback);
    method public void startTruncatedScan(java.util.List<android.bluetooth.le.TruncatedFilter>, android.bluetooth.le.ScanSettings, android.bluetooth.le.ScanCallback);
  }

  public final class ResultStorageDescriptor implements android.os.Parcelable {
    ctor public ResultStorageDescriptor(int, int, int);
    method public int describeContents();
    method public int getLength();
    method public int getOffset();
    method public int getType();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
  }

  public final class ScanSettings implements android.os.Parcelable {
    field public static final int SCAN_RESULT_TYPE_ABBREVIATED = 1; // 0x1
    field public static final int SCAN_RESULT_TYPE_FULL = 0; // 0x0
  }

  public static final class ScanSettings.Builder {
    method public android.bluetooth.le.ScanSettings.Builder setScanResultType(int);
  }

  public final class TruncatedFilter {
    ctor public TruncatedFilter(android.bluetooth.le.ScanFilter, java.util.List<android.bluetooth.le.ResultStorageDescriptor>);
    method public android.bluetooth.le.ScanFilter getFilter();
    method public java.util.List<android.bluetooth.le.ResultStorageDescriptor> getStorageDescriptors();
  }

}

package android.content {

  public abstract class Context {
    method public boolean bindServiceAsUser(android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle);
    method public abstract android.content.Context createCredentialProtectedStorageContext();
    method public android.content.Context createPackageContextAsUser(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract java.io.File getPreloadsFileCache();
    method public abstract boolean isCredentialProtectedStorage();
    method public abstract void sendBroadcast(android.content.Intent, java.lang.String, android.os.Bundle);
    method public abstract void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.os.Bundle);
    method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.os.Bundle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    field public static final java.lang.String BACKUP_SERVICE = "backup";
    field public static final java.lang.String CONTEXTHUB_SERVICE = "contexthub";
    field public static final java.lang.String EUICC_CARD_SERVICE = "euicc_card";
    field public static final java.lang.String HDMI_CONTROL_SERVICE = "hdmi_control";
    field public static final java.lang.String NETWORK_SCORE_SERVICE = "network_score";
    field public static final java.lang.String OEM_LOCK_SERVICE = "oem_lock";
    field public static final java.lang.String PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block";
    field public static final java.lang.String SECURE_ELEMENT_SERVICE = "secure_element";
    field public static final java.lang.String STATS_MANAGER = "stats";
    field public static final java.lang.String SYSTEM_UPDATE_SERVICE = "system_update";
    field public static final java.lang.String VR_SERVICE = "vrmanager";
    field public static final deprecated java.lang.String WIFI_RTT_SERVICE = "rttmanager";
    field public static final java.lang.String WIFI_SCANNING_SERVICE = "wifiscanner";
  }

  public class ContextWrapper extends android.content.Context {
    method public android.content.Context createCredentialProtectedStorageContext();
    method public java.io.File getPreloadsFileCache();
    method public boolean isCredentialProtectedStorage();
    method public void sendBroadcast(android.content.Intent, java.lang.String, android.os.Bundle);
    method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.os.Bundle);
    method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.os.Bundle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
  }

  public class Intent implements java.lang.Cloneable android.os.Parcelable {
    field public static final java.lang.String ACTION_BATTERY_LEVEL_CHANGED = "android.intent.action.BATTERY_LEVEL_CHANGED";
    field public static final java.lang.String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
    field public static final java.lang.String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED";
    field public static final java.lang.String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET";
    field public static final java.lang.String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";
    field public static final java.lang.String ACTION_INSTALL_INSTANT_APP_PACKAGE = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE";
    field public static final java.lang.String ACTION_INSTANT_APP_RESOLVER_SETTINGS = "android.intent.action.INSTANT_APP_RESOLVER_SETTINGS";
    field public static final java.lang.String ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION";
    field public static final java.lang.String ACTION_MANAGE_APP_PERMISSIONS = "android.intent.action.MANAGE_APP_PERMISSIONS";
    field public static final java.lang.String ACTION_MANAGE_PERMISSIONS = "android.intent.action.MANAGE_PERMISSIONS";
    field public static final java.lang.String ACTION_MANAGE_PERMISSION_APPS = "android.intent.action.MANAGE_PERMISSION_APPS";
    field public static final java.lang.String ACTION_MASTER_CLEAR_NOTIFICATION = "android.intent.action.MASTER_CLEAR_NOTIFICATION";
    field public static final java.lang.String ACTION_PRE_BOOT_COMPLETED = "android.intent.action.PRE_BOOT_COMPLETED";
    field public static final java.lang.String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
    field public static final java.lang.String ACTION_RESOLVE_INSTANT_APP_PACKAGE = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE";
    field public static final java.lang.String ACTION_REVIEW_PERMISSIONS = "android.intent.action.REVIEW_PERMISSIONS";
    field public static final java.lang.String ACTION_SHOW_SUSPENDED_APP_DETAILS = "android.intent.action.SHOW_SUSPENDED_APP_DETAILS";
    field public static final deprecated java.lang.String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
    field public static final java.lang.String ACTION_SPLIT_CONFIGURATION_CHANGED = "android.intent.action.SPLIT_CONFIGURATION_CHANGED";
    field public static final java.lang.String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP";
    field public static final java.lang.String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED";
    field public static final java.lang.String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST";
    field public static final java.lang.String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS";
    field public static final java.lang.String EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE";
    field public static final java.lang.String EXTRA_FORCE_FACTORY_RESET = "android.intent.extra.FORCE_FACTORY_RESET";
    field public static final java.lang.String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION";
    field public static final java.lang.String EXTRA_INSTANT_APP_BUNDLES = "android.intent.extra.INSTANT_APP_BUNDLES";
    field public static final java.lang.String EXTRA_INSTANT_APP_EXTRAS = "android.intent.extra.INSTANT_APP_EXTRAS";
    field public static final java.lang.String EXTRA_INSTANT_APP_FAILURE = "android.intent.extra.INSTANT_APP_FAILURE";
    field public static final java.lang.String EXTRA_INSTANT_APP_HOSTNAME = "android.intent.extra.INSTANT_APP_HOSTNAME";
    field public static final java.lang.String EXTRA_INSTANT_APP_SUCCESS = "android.intent.extra.INSTANT_APP_SUCCESS";
    field public static final java.lang.String EXTRA_INSTANT_APP_TOKEN = "android.intent.extra.INSTANT_APP_TOKEN";
    field public static final java.lang.String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE";
    field public static final java.lang.String EXTRA_ORIGINATING_UID = "android.intent.extra.ORIGINATING_UID";
    field public static final java.lang.String EXTRA_PACKAGES = "android.intent.extra.PACKAGES";
    field public static final java.lang.String EXTRA_PERMISSION_NAME = "android.intent.extra.PERMISSION_NAME";
    field public static final java.lang.String EXTRA_REASON = "android.intent.extra.REASON";
    field public static final java.lang.String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK";
    field public static final java.lang.String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED";
    field public static final java.lang.String EXTRA_UNKNOWN_INSTANT_APP = "android.intent.extra.UNKNOWN_INSTANT_APP";
    field public static final java.lang.String EXTRA_VERIFICATION_BUNDLE = "android.intent.extra.VERIFICATION_BUNDLE";
  }

  public class IntentFilter implements android.os.Parcelable {
    method public final int getOrder();
    method public final void setOrder(int);
  }

}

package android.content.pm {

  public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    method public boolean isInstantApp();
    field public java.lang.String credentialProtectedDataDir;
    field public int targetSandboxVersion;
  }

  public final class InstantAppInfo implements android.os.Parcelable {
    ctor public InstantAppInfo(android.content.pm.ApplicationInfo, java.lang.String[], java.lang.String[]);
    ctor public InstantAppInfo(java.lang.String, java.lang.CharSequence, java.lang.String[], java.lang.String[]);
    method public int describeContents();
    method public android.content.pm.ApplicationInfo getApplicationInfo();
    method public java.lang.String[] getGrantedPermissions();
    method public java.lang.String getPackageName();
    method public java.lang.String[] getRequestedPermissions();
    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
    method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppInfo> CREATOR;
  }

  public final class InstantAppIntentFilter implements android.os.Parcelable {
    ctor public InstantAppIntentFilter(java.lang.String, java.util.List<android.content.IntentFilter>);
    method public int describeContents();
    method public java.util.List<android.content.IntentFilter> getFilters();
    method public java.lang.String getSplitName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppIntentFilter> CREATOR;
  }

  public final class InstantAppResolveInfo implements android.os.Parcelable {
    ctor public InstantAppResolveInfo(android.content.pm.InstantAppResolveInfo.InstantAppDigest, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>, int);
    ctor public InstantAppResolveInfo(android.content.pm.InstantAppResolveInfo.InstantAppDigest, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>, long, android.os.Bundle);
    ctor public InstantAppResolveInfo(java.lang.String, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>);
    ctor public InstantAppResolveInfo(android.os.Bundle);
    method public int describeContents();
    method public byte[] getDigestBytes();
    method public int getDigestPrefix();
    method public android.os.Bundle getExtras();
    method public java.util.List<android.content.pm.InstantAppIntentFilter> getIntentFilters();
    method public long getLongVersionCode();
    method public java.lang.String getPackageName();
    method public deprecated int getVersionCode();
    method public boolean shouldLetInstallerDecide();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo> CREATOR;
  }

  public static final class InstantAppResolveInfo.InstantAppDigest implements android.os.Parcelable {
    ctor public InstantAppResolveInfo.InstantAppDigest(java.lang.String);
    method public int describeContents();
    method public byte[][] getDigestBytes();
    method public int[] getDigestPrefix();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo.InstantAppDigest> CREATOR;
    field public static final android.content.pm.InstantAppResolveInfo.InstantAppDigest UNDEFINED;
  }

  public final class IntentFilterVerificationInfo implements android.os.Parcelable {
    method public int describeContents();
    method public java.util.Set<java.lang.String> getDomains();
    method public java.lang.String getPackageName();
    method public int getStatus();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.content.pm.IntentFilterVerificationInfo> CREATOR;
  }

  public class PackageInstaller {
    method public void setPermissionsResult(int, boolean);
  }

  public static class PackageInstaller.Session implements java.io.Closeable {
    method public void commitTransferred(android.content.IntentSender);
  }

  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
    method public boolean getAllocateAggressive();
    method public boolean getAllowDowngrade();
    method public boolean getDontKillApp();
    method public java.lang.String[] getGrantedRuntimePermissions();
    method public boolean getInstallAsFullApp(boolean);
    method public boolean getInstallAsInstantApp(boolean);
    method public boolean getInstallAsVirtualPreload();
  }

  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
    method public void setAllocateAggressive(boolean);
    method public void setAllowDowngrade(boolean);
    method public void setDontKillApp(boolean);
    method public void setGrantedRuntimePermissions(java.lang.String[]);
    method public void setInstallAsInstantApp(boolean);
    method public void setInstallAsVirtualPreload();
  }

  public class PackageItemInfo {
    method public deprecated java.lang.CharSequence loadSafeLabel(android.content.pm.PackageManager);
    method public java.lang.CharSequence loadSafeLabel(android.content.pm.PackageManager, float, int);
    field public static final int SAFE_LABEL_FLAG_FIRST_LINE = 4; // 0x4
    field public static final int SAFE_LABEL_FLAG_SINGLE_LINE = 2; // 0x2
    field public static final int SAFE_LABEL_FLAG_TRIM = 1; // 0x1
  }

  public abstract class PackageManager {
    method public abstract void addOnPermissionsChangeListener(android.content.pm.PackageManager.OnPermissionsChangedListener);
    method public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(java.lang.String);
    method public android.content.pm.dex.ArtManager getArtManager();
    method public abstract java.lang.String getDefaultBrowserPackageNameAsUser(int);
    method public java.lang.CharSequence getHarmfulAppWarning(java.lang.String);
    method public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
    method public abstract android.graphics.drawable.Drawable getInstantAppIcon(java.lang.String);
    method public abstract android.content.ComponentName getInstantAppInstallerComponent();
    method public abstract android.content.ComponentName getInstantAppResolverSettingsComponent();
    method public abstract java.util.List<android.content.pm.InstantAppInfo> getInstantApps();
    method public abstract java.util.List<android.content.pm.IntentFilterVerificationInfo> getIntentFilterVerifications(java.lang.String);
    method public abstract int getIntentVerificationStatusAsUser(java.lang.String, int);
    method public abstract int getPermissionFlags(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract void grantRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract int installExistingPackage(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract int installExistingPackage(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean isPackageSuspended(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(android.content.Intent, int, android.os.UserHandle);
    method public abstract void registerDexModule(java.lang.String, android.content.pm.PackageManager.DexModuleRegisterCallback);
    method public abstract void removeOnPermissionsChangeListener(android.content.pm.PackageManager.OnPermissionsChangedListener);
    method public abstract void revokeRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract boolean setDefaultBrowserPackageNameAsUser(java.lang.String, int);
    method public void setHarmfulAppWarning(java.lang.String, java.lang.CharSequence);
    method public java.lang.String[] setPackagesSuspended(java.lang.String[], boolean, android.os.PersistableBundle, android.os.PersistableBundle, java.lang.String);
    method public abstract void setUpdateAvailable(java.lang.String, boolean);
    method public abstract boolean updateIntentVerificationStatusAsUser(java.lang.String, int, int);
    method public abstract void updatePermissionFlags(java.lang.String, java.lang.String, int, int, android.os.UserHandle);
    method public abstract void verifyIntentFilter(int, int, java.util.List<java.lang.String>);
    field public static final java.lang.String ACTION_REQUEST_PERMISSIONS = "android.content.pm.action.REQUEST_PERMISSIONS";
    field public static final java.lang.String EXTRA_REQUEST_PERMISSIONS_NAMES = "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
    field public static final java.lang.String EXTRA_REQUEST_PERMISSIONS_RESULTS = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
    field public static final java.lang.String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
    field public static final java.lang.String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
    field public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 32; // 0x20
    field public static final int FLAG_PERMISSION_POLICY_FIXED = 4; // 0x4
    field public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 64; // 0x40
    field public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 8; // 0x8
    field public static final int FLAG_PERMISSION_SYSTEM_FIXED = 16; // 0x10
    field public static final int FLAG_PERMISSION_USER_FIXED = 2; // 0x2
    field public static final int FLAG_PERMISSION_USER_SET = 1; // 0x1
    field public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; // 0xffffffff
    field public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; // 0xfffffff3
    field public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; // 0xffffffee
    field public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; // 0xfffffff0
    field public static final int INSTALL_FAILED_DEXOPT = -11; // 0xfffffff5
    field public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; // 0xfffffffb
    field public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; // 0xfffffffc
    field public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; // 0xffffff92
    field public static final int INSTALL_FAILED_INVALID_APK = -2; // 0xfffffffe
    field public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; // 0xffffffed
    field public static final int INSTALL_FAILED_INVALID_URI = -3; // 0xfffffffd
    field public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; // 0xffffffec
    field public static final int INSTALL_FAILED_MISSING_FEATURE = -17; // 0xffffffef
    field public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; // 0xfffffff7
    field public static final int INSTALL_FAILED_NEWER_SDK = -14; // 0xfffffff2
    field public static final int INSTALL_FAILED_NO_SHARED_USER = -6; // 0xfffffffa
    field public static final int INSTALL_FAILED_OLDER_SDK = -12; // 0xfffffff4
    field public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; // 0xffffffe9
    field public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; // 0xffffffe6
    field public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; // 0xfffffff6
    field public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27; // 0xffffffe5
    field public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; // 0xfffffff8
    field public static final int INSTALL_FAILED_TEST_ONLY = -15; // 0xfffffff1
    field public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; // 0xfffffff9
    field public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; // 0xffffffea
    field public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; // 0xffffffeb
    field public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; // 0xffffff9b
    field public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; // 0xffffff96
    field public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; // 0xffffff95
    field public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; // 0xffffff97
    field public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; // 0xffffff98
    field public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; // 0xffffff93
    field public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; // 0xffffff94
    field public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; // 0xffffff9c
    field public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; // 0xffffff99
    field public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; // 0xffffff9a
    field public static final int INSTALL_SUCCEEDED = 1; // 0x1
    field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; // 0x2
    field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; // 0x4
    field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; // 0x1
    field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; // 0x3
    field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; // 0x0
    field public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; // 0xffffffff
    field public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; // 0x1
    field public static final int MASK_PERMISSION_FLAGS = 255; // 0xff
    field public static final int MATCH_ANY_USER = 4194304; // 0x400000
    field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000
    field public static final int MATCH_INSTANT = 8388608; // 0x800000
  }

  public static abstract class PackageManager.DexModuleRegisterCallback {
    ctor public PackageManager.DexModuleRegisterCallback();
    method public abstract void onDexModuleRegistered(java.lang.String, boolean, java.lang.String);
  }

  public static abstract interface PackageManager.OnPermissionsChangedListener {
    method public abstract void onPermissionsChanged(int);
  }

  public static abstract class PackageManager.PermissionFlags implements java.lang.annotation.Annotation {
  }

  public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    field public int backgroundRequestDetailResourceId;
    field public int backgroundRequestResourceId;
    field public int requestDetailResourceId;
    field public int requestRes;
  }

  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
    field public static final int FLAG_REMOVED = 2; // 0x2
    field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
    field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
    field public java.lang.String backgroundPermission;
    field public int requestRes;
  }

}

package android.content.pm.dex {

  public class ArtManager {
    method public boolean isRuntimeProfilingEnabled(int);
    method public void snapshotRuntimeProfile(int, java.lang.String, java.lang.String, java.util.concurrent.Executor, android.content.pm.dex.ArtManager.SnapshotRuntimeProfileCallback);
    field public static final int PROFILE_APPS = 0; // 0x0
    field public static final int PROFILE_BOOT_IMAGE = 1; // 0x1
    field public static final int SNAPSHOT_FAILED_CODE_PATH_NOT_FOUND = 1; // 0x1
    field public static final int SNAPSHOT_FAILED_INTERNAL_ERROR = 2; // 0x2
    field public static final int SNAPSHOT_FAILED_PACKAGE_NOT_FOUND = 0; // 0x0
  }

  public static abstract class ArtManager.SnapshotRuntimeProfileCallback {
    ctor public ArtManager.SnapshotRuntimeProfileCallback();
    method public abstract void onError(int);
    method public abstract void onSuccess(android.os.ParcelFileDescriptor);
  }

}

package android.content.pm.permission {

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

}

package android.hardware {

  public final class Sensor {
    method public java.util.UUID getUuid();
    method public boolean isDataInjectionSupported();
    field public static final java.lang.String STRING_TYPE_DYNAMIC_SENSOR_META = "android.sensor.dynamic_sensor_meta";
    field public static final java.lang.String STRING_TYPE_WRIST_TILT_GESTURE = "android.sensor.wrist_tilt_gesture";
    field public static final int TYPE_DYNAMIC_SENSOR_META = 32; // 0x20
    field public static final int TYPE_WRIST_TILT_GESTURE = 26; // 0x1a
  }

  public abstract class SensorManager {
    method public boolean initDataInjection(boolean);
    method public boolean injectSensorData(android.hardware.Sensor, float[], int, long);
  }

}

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.camera2.params {

  public final class OutputConfiguration implements android.os.Parcelable {
    ctor public OutputConfiguration(android.view.Surface, int);
    ctor public OutputConfiguration(int, android.view.Surface, int);
    method public int getRotation();
    field public static final int ROTATION_0 = 0; // 0x0
    field public static final int ROTATION_180 = 2; // 0x2
    field public static final int ROTATION_270 = 3; // 0x3
    field public static final int ROTATION_90 = 1; // 0x1
  }

}

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.util.Pair<float[], float[]> getMinimumBrightnessCurve();
    method public android.graphics.Point getStableDisplaySize();
    method public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
    method public void setSaturationLevel(float);
  }

}

package android.hardware.hdmi {

  public abstract class HdmiClient {
    method public android.hardware.hdmi.HdmiDeviceInfo getActiveSource();
    method public void sendKeyEvent(int, boolean);
    method public void sendVendorCommand(int, byte[], boolean);
    method public void setVendorCommandListener(android.hardware.hdmi.HdmiControlManager.VendorCommandListener);
  }

  public final class HdmiControlManager {
    method public void addHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
    method public android.hardware.hdmi.HdmiClient getClient(int);
    method public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient();
    method public android.hardware.hdmi.HdmiTvClient getTvClient();
    method public void removeHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
    method public void setStandbyMode(boolean);
    field public static final java.lang.String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";
    field public static final int AVR_VOLUME_MUTED = 101; // 0x65
    field public static final int CLEAR_TIMER_STATUS_CEC_DISABLE = 162; // 0xa2
    field public static final int CLEAR_TIMER_STATUS_CHECK_RECORDER_CONNECTION = 160; // 0xa0
    field public static final int CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE = 161; // 0xa1
    field public static final int CLEAR_TIMER_STATUS_TIMER_CLEARED = 128; // 0x80
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_NO_INFO_AVAILABLE = 2; // 0x2
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_NO_MATCHING = 1; // 0x1
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_RECORDING = 0; // 0x0
    field public static final int CONTROL_STATE_CHANGED_REASON_SETTING = 1; // 0x1
    field public static final int CONTROL_STATE_CHANGED_REASON_STANDBY = 3; // 0x3
    field public static final int CONTROL_STATE_CHANGED_REASON_START = 0; // 0x0
    field public static final int CONTROL_STATE_CHANGED_REASON_WAKEUP = 2; // 0x2
    field public static final int DEVICE_EVENT_ADD_DEVICE = 1; // 0x1
    field public static final int DEVICE_EVENT_REMOVE_DEVICE = 2; // 0x2
    field public static final int DEVICE_EVENT_UPDATE_DEVICE = 3; // 0x3
    field public static final java.lang.String EXTRA_MESSAGE_EXTRA_PARAM1 = "android.hardware.hdmi.extra.MESSAGE_EXTRA_PARAM1";
    field public static final java.lang.String EXTRA_MESSAGE_ID = "android.hardware.hdmi.extra.MESSAGE_ID";
    field public static final int ONE_TOUCH_RECORD_ALREADY_RECORDING = 18; // 0x12
    field public static final int ONE_TOUCH_RECORD_CEC_DISABLED = 51; // 0x33
    field public static final int ONE_TOUCH_RECORD_CHECK_RECORDER_CONNECTION = 49; // 0x31
    field public static final int ONE_TOUCH_RECORD_DISALLOW_TO_COPY = 13; // 0xd
    field public static final int ONE_TOUCH_RECORD_DISALLOW_TO_FUTHER_COPIES = 14; // 0xe
    field public static final int ONE_TOUCH_RECORD_FAIL_TO_RECORD_DISPLAYED_SCREEN = 50; // 0x32
    field public static final int ONE_TOUCH_RECORD_INVALID_EXTERNAL_PHYSICAL_ADDRESS = 10; // 0xa
    field public static final int ONE_TOUCH_RECORD_INVALID_EXTERNAL_PLUG_NUMBER = 9; // 0x9
    field public static final int ONE_TOUCH_RECORD_MEDIA_PROBLEM = 21; // 0x15
    field public static final int ONE_TOUCH_RECORD_MEDIA_PROTECTED = 19; // 0x13
    field public static final int ONE_TOUCH_RECORD_NOT_ENOUGH_SPACE = 22; // 0x16
    field public static final int ONE_TOUCH_RECORD_NO_MEDIA = 16; // 0x10
    field public static final int ONE_TOUCH_RECORD_NO_OR_INSUFFICIENT_CA_ENTITLEMENTS = 12; // 0xc
    field public static final int ONE_TOUCH_RECORD_NO_SOURCE_SIGNAL = 20; // 0x14
    field public static final int ONE_TOUCH_RECORD_OTHER_REASON = 31; // 0x1f
    field public static final int ONE_TOUCH_RECORD_PARENT_LOCK_ON = 23; // 0x17
    field public static final int ONE_TOUCH_RECORD_PLAYING = 17; // 0x11
    field public static final int ONE_TOUCH_RECORD_PREVIOUS_RECORDING_IN_PROGRESS = 48; // 0x30
    field public static final int ONE_TOUCH_RECORD_RECORDING_ALREADY_TERMINATED = 27; // 0x1b
    field public static final int ONE_TOUCH_RECORD_RECORDING_ANALOGUE_SERVICE = 3; // 0x3
    field public static final int ONE_TOUCH_RECORD_RECORDING_CURRENTLY_SELECTED_SOURCE = 1; // 0x1
    field public static final int ONE_TOUCH_RECORD_RECORDING_DIGITAL_SERVICE = 2; // 0x2
    field public static final int ONE_TOUCH_RECORD_RECORDING_EXTERNAL_INPUT = 4; // 0x4
    field public static final int ONE_TOUCH_RECORD_RECORDING_TERMINATED_NORMALLY = 26; // 0x1a
    field public static final int ONE_TOUCH_RECORD_UNABLE_ANALOGUE_SERVICE = 6; // 0x6
    field public static final int ONE_TOUCH_RECORD_UNABLE_DIGITAL_SERVICE = 5; // 0x5
    field public static final int ONE_TOUCH_RECORD_UNABLE_SELECTED_SERVICE = 7; // 0x7
    field public static final int ONE_TOUCH_RECORD_UNSUPPORTED_CA = 11; // 0xb
    field public static final int OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT = 1; // 0x1
    field public static final int OSD_MESSAGE_AVR_VOLUME_CHANGED = 2; // 0x2
    field public static final int POWER_STATUS_ON = 0; // 0x0
    field public static final int POWER_STATUS_STANDBY = 1; // 0x1
    field public static final int POWER_STATUS_TRANSIENT_TO_ON = 2; // 0x2
    field public static final int POWER_STATUS_TRANSIENT_TO_STANDBY = 3; // 0x3
    field public static final int POWER_STATUS_UNKNOWN = -1; // 0xffffffff
    field public static final deprecated int RESULT_ALREADY_IN_PROGRESS = 4; // 0x4
    field public static final int RESULT_COMMUNICATION_FAILED = 7; // 0x7
    field public static final int RESULT_EXCEPTION = 5; // 0x5
    field public static final int RESULT_INCORRECT_MODE = 6; // 0x6
    field public static final int RESULT_SOURCE_NOT_AVAILABLE = 2; // 0x2
    field public static final int RESULT_SUCCESS = 0; // 0x0
    field public static final int RESULT_TARGET_NOT_AVAILABLE = 3; // 0x3
    field public static final int RESULT_TIMEOUT = 1; // 0x1
    field public static final int TIMER_RECORDING_RESULT_EXTRA_CEC_DISABLED = 3; // 0x3
    field public static final int TIMER_RECORDING_RESULT_EXTRA_CHECK_RECORDER_CONNECTION = 1; // 0x1
    field public static final int TIMER_RECORDING_RESULT_EXTRA_FAIL_TO_RECORD_SELECTED_SOURCE = 2; // 0x2
    field public static final int TIMER_RECORDING_RESULT_EXTRA_NO_ERROR = 0; // 0x0
    field public static final int TIMER_RECORDING_TYPE_ANALOGUE = 2; // 0x2
    field public static final int TIMER_RECORDING_TYPE_DIGITAL = 1; // 0x1
    field public static final int TIMER_RECORDING_TYPE_EXTERNAL = 3; // 0x3
    field public static final int TIMER_STATUS_MEDIA_INFO_NOT_PRESENT = 2; // 0x2
    field public static final int TIMER_STATUS_MEDIA_INFO_PRESENT_NOT_PROTECTED = 0; // 0x0
    field public static final int TIMER_STATUS_MEDIA_INFO_PRESENT_PROTECTED = 1; // 0x1
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_CA_NOT_SUPPORTED = 6; // 0x6
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_CLOCK_FAILURE = 10; // 0xa
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_DATE_OUT_OF_RANGE = 2; // 0x2
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_DUPLICATED = 14; // 0xe
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_EXTERNAL_PHYSICAL_NUMBER = 5; // 0x5
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_EXTERNAL_PLUG_NUMBER = 4; // 0x4
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_SEQUENCE = 3; // 0x3
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_NO_CA_ENTITLEMENTS = 7; // 0x7
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_NO_FREE_TIME = 1; // 0x1
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_PARENTAL_LOCK_ON = 9; // 0x9
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_UNSUPPORTED_RESOLUTION = 8; // 0x8
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_ENOUGH_SPACE = 8; // 0x8
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_MIGHT_NOT_ENOUGH_SPACE = 11; // 0xb
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_NOT_ENOUGH_SPACE = 9; // 0x9
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_NO_MEDIA_INFO = 10; // 0xa
  }

  public static abstract interface HdmiControlManager.HotplugEventListener {
    method public abstract void onReceived(android.hardware.hdmi.HdmiHotplugEvent);
  }

  public static abstract interface HdmiControlManager.VendorCommandListener {
    method public abstract void onControlStateChanged(boolean, int);
    method public abstract void onReceived(int, int, byte[], boolean);
  }

  public class HdmiDeviceInfo implements android.os.Parcelable {
    ctor public HdmiDeviceInfo();
    method public int describeContents();
    method public int getAdopterId();
    method public int getDeviceId();
    method public int getDevicePowerStatus();
    method public int getDeviceType();
    method public java.lang.String getDisplayName();
    method public int getId();
    method public int getLogicalAddress();
    method public int getPhysicalAddress();
    method public int getPortId();
    method public int getVendorId();
    method public static int idForCecDevice(int);
    method public static int idForHardware(int);
    method public static int idForMhlDevice(int);
    method public boolean isCecDevice();
    method public boolean isInactivated();
    method public boolean isMhlDevice();
    method public boolean isSourceType();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ADDR_INTERNAL = 0; // 0x0
    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiDeviceInfo> CREATOR;
    field public static final int DEVICE_AUDIO_SYSTEM = 5; // 0x5
    field public static final int DEVICE_INACTIVE = -1; // 0xffffffff
    field public static final int DEVICE_PLAYBACK = 4; // 0x4
    field public static final int DEVICE_RECORDER = 1; // 0x1
    field public static final int DEVICE_RESERVED = 2; // 0x2
    field public static final int DEVICE_TUNER = 3; // 0x3
    field public static final int DEVICE_TV = 0; // 0x0
    field public static final int ID_INVALID = 65535; // 0xffff
    field public static final android.hardware.hdmi.HdmiDeviceInfo INACTIVE_DEVICE;
    field public static final int PATH_INTERNAL = 0; // 0x0
    field public static final int PATH_INVALID = 65535; // 0xffff
    field public static final int PORT_INVALID = -1; // 0xffffffff
  }

  public final class HdmiHotplugEvent implements android.os.Parcelable {
    method public int describeContents();
    method public int getPort();
    method public boolean isConnected();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiHotplugEvent> CREATOR;
  }

  public final class HdmiPlaybackClient extends android.hardware.hdmi.HdmiClient {
    method public int getDeviceType();
    method public void oneTouchPlay(android.hardware.hdmi.HdmiPlaybackClient.OneTouchPlayCallback);
    method public void queryDisplayStatus(android.hardware.hdmi.HdmiPlaybackClient.DisplayStatusCallback);
    method public void sendStandby();
  }

  public static abstract interface HdmiPlaybackClient.DisplayStatusCallback {
    method public abstract void onComplete(int);
  }

  public static abstract interface HdmiPlaybackClient.OneTouchPlayCallback {
    method public abstract void onComplete(int);
  }

  public final class HdmiPortInfo implements android.os.Parcelable {
    ctor public HdmiPortInfo(int, int, int, boolean, boolean, boolean);
    method public int describeContents();
    method public int getAddress();
    method public int getId();
    method public int getType();
    method public boolean isArcSupported();
    method public boolean isCecSupported();
    method public boolean isMhlSupported();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiPortInfo> CREATOR;
    field public static final int PORT_INPUT = 0; // 0x0
    field public static final int PORT_OUTPUT = 1; // 0x1
  }

  public abstract class HdmiRecordListener {
    ctor public HdmiRecordListener();
    method public void onClearTimerRecordingResult(int, int);
    method public void onOneTouchRecordResult(int, int);
    method public abstract android.hardware.hdmi.HdmiRecordSources.RecordSource onOneTouchRecordSourceRequested(int);
    method public void onTimerRecordingResult(int, android.hardware.hdmi.HdmiRecordListener.TimerStatusData);
  }

  public static class HdmiRecordListener.TimerStatusData {
    method public int getDurationHour();
    method public int getDurationMinute();
    method public int getExtraError();
    method public int getMediaInfo();
    method public int getNotProgammedError();
    method public int getProgrammedInfo();
    method public boolean isOverlapped();
    method public boolean isProgrammed();
  }

  public final class HdmiRecordSources {
    method public static boolean checkRecordSource(byte[]);
    method public static android.hardware.hdmi.HdmiRecordSources.OwnSource ofOwnSource();
  }

  public static final class HdmiRecordSources.AnalogueServiceSource extends android.hardware.hdmi.HdmiRecordSources.RecordSource {
  }

  public static final class HdmiRecordSources.DigitalServiceSource extends android.hardware.hdmi.HdmiRecordSources.RecordSource {
  }

  public static final class HdmiRecordSources.ExternalPhysicalAddress extends android.hardware.hdmi.HdmiRecordSources.RecordSource {
  }

  public static final class HdmiRecordSources.ExternalPlugData extends android.hardware.hdmi.HdmiRecordSources.RecordSource {
  }

  public static final class HdmiRecordSources.OwnSource extends android.hardware.hdmi.HdmiRecordSources.RecordSource {
  }

  public static abstract class HdmiRecordSources.RecordSource {
  }

  public class HdmiTimerRecordSources {
    method public static boolean checkTimerRecordSource(int, byte[]);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.Duration durationOf(int, int);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource ofAnalogueSource(android.hardware.hdmi.HdmiTimerRecordSources.TimerInfo, android.hardware.hdmi.HdmiRecordSources.AnalogueServiceSource);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource ofDigitalSource(android.hardware.hdmi.HdmiTimerRecordSources.TimerInfo, android.hardware.hdmi.HdmiRecordSources.DigitalServiceSource);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource ofExternalPhysicalAddress(android.hardware.hdmi.HdmiTimerRecordSources.TimerInfo, android.hardware.hdmi.HdmiRecordSources.ExternalPhysicalAddress);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource ofExternalPlug(android.hardware.hdmi.HdmiTimerRecordSources.TimerInfo, android.hardware.hdmi.HdmiRecordSources.ExternalPlugData);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.Time timeOf(int, int);
    method public static android.hardware.hdmi.HdmiTimerRecordSources.TimerInfo timerInfoOf(int, int, android.hardware.hdmi.HdmiTimerRecordSources.Time, android.hardware.hdmi.HdmiTimerRecordSources.Duration, int);
    field public static final int RECORDING_SEQUENCE_REPEAT_FRIDAY = 32; // 0x20
    field public static final int RECORDING_SEQUENCE_REPEAT_MONDAY = 2; // 0x2
    field public static final int RECORDING_SEQUENCE_REPEAT_ONCE_ONLY = 0; // 0x0
    field public static final int RECORDING_SEQUENCE_REPEAT_SATUREDAY = 64; // 0x40
    field public static final int RECORDING_SEQUENCE_REPEAT_SUNDAY = 1; // 0x1
    field public static final int RECORDING_SEQUENCE_REPEAT_THURSDAY = 16; // 0x10
    field public static final int RECORDING_SEQUENCE_REPEAT_TUESDAY = 4; // 0x4
    field public static final int RECORDING_SEQUENCE_REPEAT_WEDNESDAY = 8; // 0x8
  }

  public static final class HdmiTimerRecordSources.Duration {
  }

  public static final class HdmiTimerRecordSources.Time {
  }

  public static final class HdmiTimerRecordSources.TimerInfo {
  }

  public static final class HdmiTimerRecordSources.TimerRecordSource {
  }

  public final class HdmiTvClient extends android.hardware.hdmi.HdmiClient {
    method public void clearTimerRecording(int, int, android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource);
    method public void deviceSelect(int, android.hardware.hdmi.HdmiTvClient.SelectCallback);
    method public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getDeviceList();
    method public int getDeviceType();
    method public void portSelect(int, android.hardware.hdmi.HdmiTvClient.SelectCallback);
    method public void sendMhlVendorCommand(int, int, int, byte[]);
    method public void sendStandby(int);
    method public void setHdmiMhlVendorCommandListener(android.hardware.hdmi.HdmiTvClient.HdmiMhlVendorCommandListener);
    method public void setInputChangeListener(android.hardware.hdmi.HdmiTvClient.InputChangeListener);
    method public void setRecordListener(android.hardware.hdmi.HdmiRecordListener);
    method public void setSystemAudioMode(boolean, android.hardware.hdmi.HdmiTvClient.SelectCallback);
    method public void setSystemAudioMute(boolean);
    method public void setSystemAudioVolume(int, int, int);
    method public void startOneTouchRecord(int, android.hardware.hdmi.HdmiRecordSources.RecordSource);
    method public void startTimerRecording(int, int, android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource);
    method public void stopOneTouchRecord(int);
    field public static final int VENDOR_DATA_SIZE = 16; // 0x10
  }

  public static abstract interface HdmiTvClient.HdmiMhlVendorCommandListener {
    method public abstract void onReceived(int, int, int, byte[]);
  }

  public static abstract interface HdmiTvClient.InputChangeListener {
    method public abstract void onChanged(android.hardware.hdmi.HdmiDeviceInfo);
  }

  public static abstract interface HdmiTvClient.SelectCallback {
    method public abstract void onComplete(int);
  }

}

package android.hardware.location {

  public class ContextHubClient implements java.io.Closeable {
    method public void close();
    method public android.hardware.location.ContextHubInfo getAttachedHub();
    method public int sendMessageToNanoApp(android.hardware.location.NanoAppMessage);
  }

  public class ContextHubClientCallback {
    ctor public ContextHubClientCallback();
    method public void onHubReset(android.hardware.location.ContextHubClient);
    method public void onMessageFromNanoApp(android.hardware.location.ContextHubClient, android.hardware.location.NanoAppMessage);
    method public void onNanoAppAborted(android.hardware.location.ContextHubClient, long, int);
    method public void onNanoAppDisabled(android.hardware.location.ContextHubClient, long);
    method public void onNanoAppEnabled(android.hardware.location.ContextHubClient, long);
    method public void onNanoAppLoaded(android.hardware.location.ContextHubClient, long);
    method public void onNanoAppUnloaded(android.hardware.location.ContextHubClient, long);
  }

  public class ContextHubInfo implements android.os.Parcelable {
    ctor public ContextHubInfo();
    method public int describeContents();
    method public byte getChreApiMajorVersion();
    method public byte getChreApiMinorVersion();
    method public short getChrePatchVersion();
    method public long getChrePlatformId();
    method public int getId();
    method public int getMaxPacketLengthBytes();
    method public android.hardware.location.MemoryRegion[] getMemoryRegions();
    method public java.lang.String getName();
    method public float getPeakMips();
    method public float getPeakPowerDrawMw();
    method public int getPlatformVersion();
    method public float getSleepPowerDrawMw();
    method public int getStaticSwVersion();
    method public float getStoppedPowerDrawMw();
    method public int[] getSupportedSensors();
    method public java.lang.String getToolchain();
    method public int getToolchainVersion();
    method public java.lang.String getVendor();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubInfo> CREATOR;
  }

  public final class ContextHubManager {
    method public android.hardware.location.ContextHubClient createClient(android.hardware.location.ContextHubInfo, android.hardware.location.ContextHubClientCallback, java.util.concurrent.Executor);
    method public android.hardware.location.ContextHubClient createClient(android.hardware.location.ContextHubInfo, android.hardware.location.ContextHubClientCallback);
    method public android.hardware.location.ContextHubTransaction<java.lang.Void> disableNanoApp(android.hardware.location.ContextHubInfo, long);
    method public android.hardware.location.ContextHubTransaction<java.lang.Void> enableNanoApp(android.hardware.location.ContextHubInfo, long);
    method public deprecated int[] findNanoAppOnHub(int, android.hardware.location.NanoAppFilter);
    method public deprecated int[] getContextHubHandles();
    method public deprecated android.hardware.location.ContextHubInfo getContextHubInfo(int);
    method public java.util.List<android.hardware.location.ContextHubInfo> getContextHubs();
    method public deprecated android.hardware.location.NanoAppInstanceInfo getNanoAppInstanceInfo(int);
    method public deprecated int loadNanoApp(int, android.hardware.location.NanoApp);
    method public android.hardware.location.ContextHubTransaction<java.lang.Void> loadNanoApp(android.hardware.location.ContextHubInfo, android.hardware.location.NanoAppBinary);
    method public android.hardware.location.ContextHubTransaction<java.util.List<android.hardware.location.NanoAppState>> queryNanoApps(android.hardware.location.ContextHubInfo);
    method public deprecated int registerCallback(android.hardware.location.ContextHubManager.Callback);
    method public deprecated int registerCallback(android.hardware.location.ContextHubManager.Callback, android.os.Handler);
    method public deprecated int sendMessage(int, int, android.hardware.location.ContextHubMessage);
    method public deprecated int unloadNanoApp(int);
    method public android.hardware.location.ContextHubTransaction<java.lang.Void> unloadNanoApp(android.hardware.location.ContextHubInfo, long);
    method public deprecated int unregisterCallback(android.hardware.location.ContextHubManager.Callback);
  }

  public static abstract deprecated class ContextHubManager.Callback {
    ctor protected ContextHubManager.Callback();
    method public abstract void onMessageReceipt(int, int, android.hardware.location.ContextHubMessage);
  }

  public deprecated class ContextHubMessage implements android.os.Parcelable {
    ctor public ContextHubMessage(int, int, byte[]);
    method public int describeContents();
    method public byte[] getData();
    method public int getMsgType();
    method public int getVersion();
    method public void setMsgData(byte[]);
    method public void setMsgType(int);
    method public void setVersion(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubMessage> CREATOR;
  }

  public class ContextHubTransaction<T> {
    method public int getType();
    method public void setOnCompleteListener(android.hardware.location.ContextHubTransaction.OnCompleteListener<T>, java.util.concurrent.Executor);
    method public void setOnCompleteListener(android.hardware.location.ContextHubTransaction.OnCompleteListener<T>);
    method public static java.lang.String typeToString(int, boolean);
    method public android.hardware.location.ContextHubTransaction.Response<T> waitForResponse(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
    field public static final int RESULT_FAILED_AT_HUB = 5; // 0x5
    field public static final int RESULT_FAILED_BAD_PARAMS = 2; // 0x2
    field public static final int RESULT_FAILED_BUSY = 4; // 0x4
    field public static final int RESULT_FAILED_HAL_UNAVAILABLE = 8; // 0x8
    field public static final int RESULT_FAILED_SERVICE_INTERNAL_FAILURE = 7; // 0x7
    field public static final int RESULT_FAILED_TIMEOUT = 6; // 0x6
    field public static final int RESULT_FAILED_UNINITIALIZED = 3; // 0x3
    field public static final int RESULT_FAILED_UNKNOWN = 1; // 0x1
    field public static final int RESULT_SUCCESS = 0; // 0x0
    field public static final int TYPE_DISABLE_NANOAPP = 3; // 0x3
    field public static final int TYPE_ENABLE_NANOAPP = 2; // 0x2
    field public static final int TYPE_LOAD_NANOAPP = 0; // 0x0
    field public static final int TYPE_QUERY_NANOAPPS = 4; // 0x4
    field public static final int TYPE_UNLOAD_NANOAPP = 1; // 0x1
  }

  public static abstract interface ContextHubTransaction.OnCompleteListener<L> {
    method public abstract void onComplete(android.hardware.location.ContextHubTransaction<L>, android.hardware.location.ContextHubTransaction.Response<L>);
  }

  public static class ContextHubTransaction.Response<R> {
    method public R getContents();
    method public int getResult();
  }

  public final class GeofenceHardware {
    method public boolean addGeofence(int, int, android.hardware.location.GeofenceHardwareRequest, android.hardware.location.GeofenceHardwareCallback);
    method public int[] getMonitoringTypes();
    method public int getStatusOfMonitoringType(int);
    method public boolean pauseGeofence(int, int);
    method public boolean registerForMonitorStateChangeCallback(int, android.hardware.location.GeofenceHardwareMonitorCallback);
    method public boolean removeGeofence(int, int);
    method public boolean resumeGeofence(int, int, int);
    method public boolean unregisterForMonitorStateChangeCallback(int, android.hardware.location.GeofenceHardwareMonitorCallback);
    field public static final int GEOFENCE_ENTERED = 1; // 0x1
    field public static final int GEOFENCE_ERROR_ID_EXISTS = 2; // 0x2
    field public static final int GEOFENCE_ERROR_ID_UNKNOWN = 3; // 0x3
    field public static final int GEOFENCE_ERROR_INSUFFICIENT_MEMORY = 6; // 0x6
    field public static final int GEOFENCE_ERROR_INVALID_TRANSITION = 4; // 0x4
    field public static final int GEOFENCE_ERROR_TOO_MANY_GEOFENCES = 1; // 0x1
    field public static final int GEOFENCE_EXITED = 2; // 0x2
    field public static final int GEOFENCE_FAILURE = 5; // 0x5
    field public static final int GEOFENCE_SUCCESS = 0; // 0x0
    field public static final int GEOFENCE_UNCERTAIN = 4; // 0x4
    field public static final int MONITORING_TYPE_FUSED_HARDWARE = 1; // 0x1
    field public static final int MONITORING_TYPE_GPS_HARDWARE = 0; // 0x0
    field public static final int MONITOR_CURRENTLY_AVAILABLE = 0; // 0x0
    field public static final int MONITOR_CURRENTLY_UNAVAILABLE = 1; // 0x1
    field public static final int MONITOR_UNSUPPORTED = 2; // 0x2
    field public static final int SOURCE_TECHNOLOGY_BLUETOOTH = 16; // 0x10
    field public static final int SOURCE_TECHNOLOGY_CELL = 8; // 0x8
    field public static final int SOURCE_TECHNOLOGY_GNSS = 1; // 0x1
    field public static final int SOURCE_TECHNOLOGY_SENSORS = 4; // 0x4
    field public static final int SOURCE_TECHNOLOGY_WIFI = 2; // 0x2
  }

  public abstract class GeofenceHardwareCallback {
    ctor public GeofenceHardwareCallback();
    method public void onGeofenceAdd(int, int);
    method public void onGeofencePause(int, int);
    method public void onGeofenceRemove(int, int);
    method public void onGeofenceResume(int, int);
    method public void onGeofenceTransition(int, int, android.location.Location, long, int);
  }

  public abstract class GeofenceHardwareMonitorCallback {
    ctor public GeofenceHardwareMonitorCallback();
    method public deprecated void onMonitoringSystemChange(int, boolean, android.location.Location);
    method public void onMonitoringSystemChange(android.hardware.location.GeofenceHardwareMonitorEvent);
  }

  public class GeofenceHardwareMonitorEvent implements android.os.Parcelable {
    ctor public GeofenceHardwareMonitorEvent(int, int, int, android.location.Location);
    method public int describeContents();
    method public android.location.Location getLocation();
    method public int getMonitoringStatus();
    method public int getMonitoringType();
    method public int getSourceTechnologies();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.GeofenceHardwareMonitorEvent> CREATOR;
  }

  public final class GeofenceHardwareRequest {
    ctor public GeofenceHardwareRequest();
    method public static android.hardware.location.GeofenceHardwareRequest createCircularGeofence(double, double, double);
    method public int getLastTransition();
    method public double getLatitude();
    method public double getLongitude();
    method public int getMonitorTransitions();
    method public int getNotificationResponsiveness();
    method public double getRadius();
    method public int getSourceTechnologies();
    method public int getUnknownTimer();
    method public void setLastTransition(int);
    method public void setMonitorTransitions(int);
    method public void setNotificationResponsiveness(int);
    method public void setSourceTechnologies(int);
    method public void setUnknownTimer(int);
  }

  public class MemoryRegion implements android.os.Parcelable {
    ctor public MemoryRegion(android.os.Parcel);
    method public int describeContents();
    method public int getCapacityBytes();
    method public int getFreeCapacityBytes();
    method public boolean isExecutable();
    method public boolean isReadable();
    method public boolean isWritable();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.MemoryRegion> CREATOR;
  }

  public deprecated class NanoApp implements android.os.Parcelable {
    ctor public NanoApp();
    ctor public deprecated NanoApp(int, byte[]);
    ctor public NanoApp(long, byte[]);
    method public int describeContents();
    method public byte[] getAppBinary();
    method public long getAppId();
    method public int getAppVersion();
    method public java.lang.String getName();
    method public int getNeededExecMemBytes();
    method public int getNeededReadMemBytes();
    method public int[] getNeededSensors();
    method public int getNeededWriteMemBytes();
    method public int[] getOutputEvents();
    method public java.lang.String getPublisher();
    method public void setAppBinary(byte[]);
    method public void setAppId(long);
    method public void setAppVersion(int);
    method public void setName(java.lang.String);
    method public void setNeededExecMemBytes(int);
    method public void setNeededReadMemBytes(int);
    method public void setNeededSensors(int[]);
    method public void setNeededWriteMemBytes(int);
    method public void setOutputEvents(int[]);
    method public void setPublisher(java.lang.String);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoApp> CREATOR;
  }

  public final class NanoAppBinary implements android.os.Parcelable {
    ctor public NanoAppBinary(byte[]);
    method public int describeContents();
    method public byte[] getBinary();
    method public byte[] getBinaryNoHeader();
    method public int getFlags();
    method public int getHeaderVersion();
    method public long getHwHubType();
    method public long getNanoAppId();
    method public int getNanoAppVersion();
    method public byte getTargetChreApiMajorVersion();
    method public byte getTargetChreApiMinorVersion();
    method public boolean hasValidHeader();
    method public boolean isEncrypted();
    method public boolean isSigned();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppBinary> CREATOR;
  }

  public deprecated class NanoAppFilter implements android.os.Parcelable {
    ctor public NanoAppFilter(long, int, int, long);
    method public int describeContents();
    method public boolean testMatch(android.hardware.location.NanoAppInstanceInfo);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int APP_ANY = -1; // 0xffffffff
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppFilter> CREATOR;
    field public static final int FLAGS_VERSION_ANY = -1; // 0xffffffff
    field public static final int FLAGS_VERSION_GREAT_THAN = 2; // 0x2
    field public static final int FLAGS_VERSION_LESS_THAN = 4; // 0x4
    field public static final int FLAGS_VERSION_STRICTLY_EQUAL = 8; // 0x8
    field public static final int HUB_ANY = -1; // 0xffffffff
    field public static final int VENDOR_ANY = -1; // 0xffffffff
  }

  public deprecated class NanoAppInstanceInfo implements android.os.Parcelable {
    ctor public NanoAppInstanceInfo();
    method public int describeContents();
    method public long getAppId();
    method public int getAppVersion();
    method public int getContexthubId();
    method public int getHandle();
    method public java.lang.String getName();
    method public int getNeededExecMemBytes();
    method public int getNeededReadMemBytes();
    method public int[] getNeededSensors();
    method public int getNeededWriteMemBytes();
    method public int[] getOutputEvents();
    method public java.lang.String getPublisher();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppInstanceInfo> CREATOR;
  }

  public final class NanoAppMessage implements android.os.Parcelable {
    method public static android.hardware.location.NanoAppMessage createMessageFromNanoApp(long, int, byte[], boolean);
    method public static android.hardware.location.NanoAppMessage createMessageToNanoApp(long, int, byte[]);
    method public int describeContents();
    method public byte[] getMessageBody();
    method public int getMessageType();
    method public long getNanoAppId();
    method public boolean isBroadcastMessage();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppMessage> CREATOR;
  }

  public final class NanoAppState implements android.os.Parcelable {
    ctor public NanoAppState(long, int, boolean);
    method public int describeContents();
    method public long getNanoAppId();
    method public long getNanoAppVersion();
    method public boolean isEnabled();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppState> CREATOR;
  }

}

package android.hardware.radio {

  public final class Announcement implements android.os.Parcelable {
    method public int describeContents();
    method public android.hardware.radio.ProgramSelector getSelector();
    method public int getType();
    method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.Announcement> CREATOR;
    field public static final int TYPE_EMERGENCY = 1; // 0x1
    field public static final int TYPE_EVENT = 6; // 0x6
    field public static final int TYPE_MISC = 8; // 0x8
    field public static final int TYPE_NEWS = 5; // 0x5
    field public static final int TYPE_SPORT = 7; // 0x7
    field public static final int TYPE_TRAFFIC = 3; // 0x3
    field public static final int TYPE_WARNING = 2; // 0x2
    field public static final int TYPE_WEATHER = 4; // 0x4
  }

  public static abstract interface Announcement.OnListUpdatedListener {
    method public abstract void onListUpdated(java.util.Collection<android.hardware.radio.Announcement>);
  }

  public final class ProgramList implements java.lang.AutoCloseable {
    method public void addOnCompleteListener(java.util.concurrent.Executor, android.hardware.radio.ProgramList.OnCompleteListener);
    method public void addOnCompleteListener(android.hardware.radio.ProgramList.OnCompleteListener);
    method public void close();
    method public android.hardware.radio.RadioManager.ProgramInfo get(android.hardware.radio.ProgramSelector.Identifier);
    method public void registerListCallback(java.util.concurrent.Executor, android.hardware.radio.ProgramList.ListCallback);
    method public void registerListCallback(android.hardware.radio.ProgramList.ListCallback);
    method public void removeOnCompleteListener(android.hardware.radio.ProgramList.OnCompleteListener);
    method public java.util.List<android.hardware.radio.RadioManager.ProgramInfo> toList();
    method public void unregisterListCallback(android.hardware.radio.ProgramList.ListCallback);
  }

  public static final class ProgramList.Filter implements android.os.Parcelable {
    ctor public ProgramList.Filter(java.util.Set<java.lang.Integer>, java.util.Set<android.hardware.radio.ProgramSelector.Identifier>, boolean, boolean);
    method public boolean areCategoriesIncluded();
    method public boolean areModificationsExcluded();
    method public int describeContents();
    method public java.util.Set<java.lang.Integer> getIdentifierTypes();
    method public java.util.Set<android.hardware.radio.ProgramSelector.Identifier> getIdentifiers();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramList.Filter> CREATOR;
  }

  public static abstract class ProgramList.ListCallback {
    ctor public ProgramList.ListCallback();
    method public void onItemChanged(android.hardware.radio.ProgramSelector.Identifier);
    method public void onItemRemoved(android.hardware.radio.ProgramSelector.Identifier);
  }

  public static abstract interface ProgramList.OnCompleteListener {
    method public abstract void onComplete();
  }

  public final class ProgramSelector implements android.os.Parcelable {
    ctor public ProgramSelector(int, android.hardware.radio.ProgramSelector.Identifier, android.hardware.radio.ProgramSelector.Identifier[], long[]);
    method public static android.hardware.radio.ProgramSelector createAmFmSelector(int, int);
    method public static android.hardware.radio.ProgramSelector createAmFmSelector(int, int, int);
    method public int describeContents();
    method public android.hardware.radio.ProgramSelector.Identifier[] getAllIds(int);
    method public long getFirstId(int);
    method public android.hardware.radio.ProgramSelector.Identifier getPrimaryId();
    method public deprecated int getProgramType();
    method public android.hardware.radio.ProgramSelector.Identifier[] getSecondaryIds();
    method public deprecated long[] getVendorIds();
    method public android.hardware.radio.ProgramSelector withSecondaryPreferred(android.hardware.radio.ProgramSelector.Identifier);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector> CREATOR;
    field public static final int IDENTIFIER_TYPE_AMFM_FREQUENCY = 1; // 0x1
    field public static final int IDENTIFIER_TYPE_DAB_ENSEMBLE = 6; // 0x6
    field public static final int IDENTIFIER_TYPE_DAB_FREQUENCY = 8; // 0x8
    field public static final int IDENTIFIER_TYPE_DAB_SCID = 7; // 0x7
    field public static final int IDENTIFIER_TYPE_DAB_SIDECC = 5; // 0x5
    field public static final int IDENTIFIER_TYPE_DAB_SID_EXT = 5; // 0x5
    field public static final int IDENTIFIER_TYPE_DRMO_FREQUENCY = 10; // 0xa
    field public static final deprecated int IDENTIFIER_TYPE_DRMO_MODULATION = 11; // 0xb
    field public static final int IDENTIFIER_TYPE_DRMO_SERVICE_ID = 9; // 0x9
    field public static final int IDENTIFIER_TYPE_HD_STATION_ID_EXT = 3; // 0x3
    field public static final int IDENTIFIER_TYPE_HD_STATION_NAME = 10004; // 0x2714
    field public static final deprecated int IDENTIFIER_TYPE_HD_SUBCHANNEL = 4; // 0x4
    field public static final int IDENTIFIER_TYPE_INVALID = 0; // 0x0
    field public static final int IDENTIFIER_TYPE_RDS_PI = 2; // 0x2
    field public static final int IDENTIFIER_TYPE_SXM_CHANNEL = 13; // 0xd
    field public static final int IDENTIFIER_TYPE_SXM_SERVICE_ID = 12; // 0xc
    field public static final int IDENTIFIER_TYPE_VENDOR_END = 1999; // 0x7cf
    field public static final deprecated int IDENTIFIER_TYPE_VENDOR_PRIMARY_END = 1999; // 0x7cf
    field public static final deprecated int IDENTIFIER_TYPE_VENDOR_PRIMARY_START = 1000; // 0x3e8
    field public static final int IDENTIFIER_TYPE_VENDOR_START = 1000; // 0x3e8
    field public static final deprecated int PROGRAM_TYPE_AM = 1; // 0x1
    field public static final deprecated int PROGRAM_TYPE_AM_HD = 3; // 0x3
    field public static final deprecated int PROGRAM_TYPE_DAB = 5; // 0x5
    field public static final deprecated int PROGRAM_TYPE_DRMO = 6; // 0x6
    field public static final deprecated int PROGRAM_TYPE_FM = 2; // 0x2
    field public static final deprecated int PROGRAM_TYPE_FM_HD = 4; // 0x4
    field public static final deprecated int PROGRAM_TYPE_INVALID = 0; // 0x0
    field public static final deprecated int PROGRAM_TYPE_SXM = 7; // 0x7
    field public static final deprecated int PROGRAM_TYPE_VENDOR_END = 1999; // 0x7cf
    field public static final deprecated int PROGRAM_TYPE_VENDOR_START = 1000; // 0x3e8
  }

  public static final class ProgramSelector.Identifier implements android.os.Parcelable {
    ctor public ProgramSelector.Identifier(int, long);
    method public int describeContents();
    method public int getType();
    method public long getValue();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector.Identifier> CREATOR;
  }

  public static abstract class ProgramSelector.IdentifierType implements java.lang.annotation.Annotation {
  }

  public static abstract deprecated class ProgramSelector.ProgramType implements java.lang.annotation.Annotation {
  }

  public class RadioManager {
    method public void addAnnouncementListener(java.util.Set<java.lang.Integer>, android.hardware.radio.Announcement.OnListUpdatedListener);
    method public void addAnnouncementListener(java.util.concurrent.Executor, java.util.Set<java.lang.Integer>, android.hardware.radio.Announcement.OnListUpdatedListener);
    method public int listModules(java.util.List<android.hardware.radio.RadioManager.ModuleProperties>);
    method public android.hardware.radio.RadioTuner openTuner(int, android.hardware.radio.RadioManager.BandConfig, boolean, android.hardware.radio.RadioTuner.Callback, android.os.Handler);
    method public void removeAnnouncementListener(android.hardware.radio.Announcement.OnListUpdatedListener);
    field public static final int BAND_AM = 0; // 0x0
    field public static final int BAND_AM_HD = 3; // 0x3
    field public static final int BAND_FM = 1; // 0x1
    field public static final int BAND_FM_HD = 2; // 0x2
    field public static final int BAND_INVALID = -1; // 0xffffffff
    field public static final int CLASS_AM_FM = 0; // 0x0
    field public static final int CLASS_DT = 2; // 0x2
    field public static final int CLASS_SAT = 1; // 0x1
    field public static final int CONFIG_DAB_DAB_LINKING = 6; // 0x6
    field public static final int CONFIG_DAB_DAB_SOFT_LINKING = 8; // 0x8
    field public static final int CONFIG_DAB_FM_LINKING = 7; // 0x7
    field public static final int CONFIG_DAB_FM_SOFT_LINKING = 9; // 0x9
    field public static final int CONFIG_FORCE_ANALOG = 2; // 0x2
    field public static final int CONFIG_FORCE_DIGITAL = 3; // 0x3
    field public static final int CONFIG_FORCE_MONO = 1; // 0x1
    field public static final int CONFIG_RDS_AF = 4; // 0x4
    field public static final int CONFIG_RDS_REG = 5; // 0x5
    field public static final int REGION_ITU_1 = 0; // 0x0
    field public static final int REGION_ITU_2 = 1; // 0x1
    field public static final int REGION_JAPAN = 3; // 0x3
    field public static final int REGION_KOREA = 4; // 0x4
    field public static final int REGION_OIRT = 2; // 0x2
    field public static final int STATUS_BAD_VALUE = -22; // 0xffffffea
    field public static final int STATUS_DEAD_OBJECT = -32; // 0xffffffe0
    field public static final int STATUS_ERROR = -2147483648; // 0x80000000
    field public static final int STATUS_INVALID_OPERATION = -38; // 0xffffffda
    field public static final int STATUS_NO_INIT = -19; // 0xffffffed
    field public static final int STATUS_OK = 0; // 0x0
    field public static final int STATUS_PERMISSION_DENIED = -1; // 0xffffffff
    field public static final int STATUS_TIMED_OUT = -110; // 0xffffff92
  }

  public static class RadioManager.AmBandConfig extends android.hardware.radio.RadioManager.BandConfig {
    method public boolean getStereo();
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandConfig> CREATOR;
  }

  public static class RadioManager.AmBandConfig.Builder {
    ctor public RadioManager.AmBandConfig.Builder(android.hardware.radio.RadioManager.AmBandDescriptor);
    ctor public RadioManager.AmBandConfig.Builder(android.hardware.radio.RadioManager.AmBandConfig);
    method public android.hardware.radio.RadioManager.AmBandConfig build();
    method public android.hardware.radio.RadioManager.AmBandConfig.Builder setStereo(boolean);
  }

  public static class RadioManager.AmBandDescriptor extends android.hardware.radio.RadioManager.BandDescriptor {
    method public boolean isStereoSupported();
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandDescriptor> CREATOR;
  }

  public static abstract class RadioManager.Band implements java.lang.annotation.Annotation {
  }

  public static class RadioManager.BandConfig implements android.os.Parcelable {
    method public int describeContents();
    method public int getLowerLimit();
    method public int getRegion();
    method public int getSpacing();
    method public int getType();
    method public int getUpperLimit();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandConfig> CREATOR;
  }

  public static class RadioManager.BandDescriptor implements android.os.Parcelable {
    method public int describeContents();
    method public int getLowerLimit();
    method public int getRegion();
    method public int getSpacing();
    method public int getType();
    method public int getUpperLimit();
    method public boolean isAmBand();
    method public boolean isFmBand();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandDescriptor> CREATOR;
  }

  public static class RadioManager.FmBandConfig extends android.hardware.radio.RadioManager.BandConfig {
    method public boolean getAf();
    method public boolean getEa();
    method public boolean getRds();
    method public boolean getStereo();
    method public boolean getTa();
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandConfig> CREATOR;
  }

  public static class RadioManager.FmBandConfig.Builder {
    ctor public RadioManager.FmBandConfig.Builder(android.hardware.radio.RadioManager.FmBandDescriptor);
    ctor public RadioManager.FmBandConfig.Builder(android.hardware.radio.RadioManager.FmBandConfig);
    method public android.hardware.radio.RadioManager.FmBandConfig build();
    method public android.hardware.radio.RadioManager.FmBandConfig.Builder setAf(boolean);
    method public android.hardware.radio.RadioManager.FmBandConfig.Builder setEa(boolean);
    method public android.hardware.radio.RadioManager.FmBandConfig.Builder setRds(boolean);
    method public android.hardware.radio.RadioManager.FmBandConfig.Builder setStereo(boolean);
    method public android.hardware.radio.RadioManager.FmBandConfig.Builder setTa(boolean);
  }

  public static class RadioManager.FmBandDescriptor extends android.hardware.radio.RadioManager.BandDescriptor {
    method public boolean isAfSupported();
    method public boolean isEaSupported();
    method public boolean isRdsSupported();
    method public boolean isStereoSupported();
    method public boolean isTaSupported();
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandDescriptor> CREATOR;
  }

  public static class RadioManager.ModuleProperties implements android.os.Parcelable {
    method public int describeContents();
    method public android.hardware.radio.RadioManager.BandDescriptor[] getBands();
    method public int getClassId();
    method public java.util.Map<java.lang.String, java.lang.Integer> getDabFrequencyTable();
    method public int getId();
    method public java.lang.String getImplementor();
    method public int getNumAudioSources();
    method public int getNumTuners();
    method public java.lang.String getProduct();
    method public java.lang.String getSerial();
    method public java.lang.String getServiceName();
    method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo();
    method public java.lang.String getVersion();
    method public boolean isBackgroundScanningSupported();
    method public boolean isCaptureSupported();
    method public boolean isInitializationRequired();
    method public boolean isProgramIdentifierSupported(int);
    method public boolean isProgramTypeSupported(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ModuleProperties> CREATOR;
  }

  public static class RadioManager.ProgramInfo implements android.os.Parcelable {
    method public int describeContents();
    method public deprecated int getChannel();
    method public android.hardware.radio.ProgramSelector.Identifier getLogicallyTunedTo();
    method public android.hardware.radio.RadioMetadata getMetadata();
    method public android.hardware.radio.ProgramSelector.Identifier getPhysicallyTunedTo();
    method public java.util.Collection<android.hardware.radio.ProgramSelector.Identifier> getRelatedContent();
    method public android.hardware.radio.ProgramSelector getSelector();
    method public int getSignalStrength();
    method public deprecated int getSubChannel();
    method public java.util.Map<java.lang.String, java.lang.String> getVendorInfo();
    method public deprecated boolean isDigital();
    method public boolean isLive();
    method public boolean isMuted();
    method public boolean isStereo();
    method public boolean isTrafficAnnouncementActive();
    method public boolean isTrafficProgram();
    method public boolean isTuned();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ProgramInfo> CREATOR;
  }

  public final class RadioMetadata implements android.os.Parcelable {
    method public boolean containsKey(java.lang.String);
    method public int describeContents();
    method public deprecated android.graphics.Bitmap getBitmap(java.lang.String);
    method public android.hardware.radio.RadioMetadata.Clock getClock(java.lang.String);
    method public int getInt(java.lang.String);
    method public java.lang.String getString(java.lang.String);
    method public java.util.Set<java.lang.String> keySet();
    method public int size();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata> CREATOR;
    field public static final java.lang.String METADATA_KEY_ALBUM = "android.hardware.radio.metadata.ALBUM";
    field public static final java.lang.String METADATA_KEY_ART = "android.hardware.radio.metadata.ART";
    field public static final java.lang.String METADATA_KEY_ARTIST = "android.hardware.radio.metadata.ARTIST";
    field public static final java.lang.String METADATA_KEY_CLOCK = "android.hardware.radio.metadata.CLOCK";
    field public static final java.lang.String METADATA_KEY_DAB_COMPONENT_NAME = "android.hardware.radio.metadata.DAB_COMPONENT_NAME";
    field public static final java.lang.String METADATA_KEY_DAB_COMPONENT_NAME_SHORT = "android.hardware.radio.metadata.DAB_COMPONENT_NAME_SHORT";
    field public static final java.lang.String METADATA_KEY_DAB_ENSEMBLE_NAME = "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME";
    field public static final java.lang.String METADATA_KEY_DAB_ENSEMBLE_NAME_SHORT = "android.hardware.radio.metadata.DAB_ENSEMBLE_NAME_SHORT";
    field public static final java.lang.String METADATA_KEY_DAB_SERVICE_NAME = "android.hardware.radio.metadata.DAB_SERVICE_NAME";
    field public static final java.lang.String METADATA_KEY_DAB_SERVICE_NAME_SHORT = "android.hardware.radio.metadata.DAB_SERVICE_NAME_SHORT";
    field public static final java.lang.String METADATA_KEY_GENRE = "android.hardware.radio.metadata.GENRE";
    field public static final java.lang.String METADATA_KEY_ICON = "android.hardware.radio.metadata.ICON";
    field public static final java.lang.String METADATA_KEY_PROGRAM_NAME = "android.hardware.radio.metadata.PROGRAM_NAME";
    field public static final java.lang.String METADATA_KEY_RBDS_PTY = "android.hardware.radio.metadata.RBDS_PTY";
    field public static final java.lang.String METADATA_KEY_RDS_PI = "android.hardware.radio.metadata.RDS_PI";
    field public static final java.lang.String METADATA_KEY_RDS_PS = "android.hardware.radio.metadata.RDS_PS";
    field public static final java.lang.String METADATA_KEY_RDS_PTY = "android.hardware.radio.metadata.RDS_PTY";
    field public static final java.lang.String METADATA_KEY_RDS_RT = "android.hardware.radio.metadata.RDS_RT";
    field public static final java.lang.String METADATA_KEY_TITLE = "android.hardware.radio.metadata.TITLE";
  }

  public static final class RadioMetadata.Builder {
    ctor public RadioMetadata.Builder();
    ctor public RadioMetadata.Builder(android.hardware.radio.RadioMetadata);
    method public android.hardware.radio.RadioMetadata build();
    method public android.hardware.radio.RadioMetadata.Builder putBitmap(java.lang.String, android.graphics.Bitmap);
    method public android.hardware.radio.RadioMetadata.Builder putClock(java.lang.String, long, int);
    method public android.hardware.radio.RadioMetadata.Builder putInt(java.lang.String, int);
    method public android.hardware.radio.RadioMetadata.Builder putString(java.lang.String, java.lang.String);
  }

  public static final class RadioMetadata.Clock implements android.os.Parcelable {
    ctor public RadioMetadata.Clock(long, int);
    method public int describeContents();
    method public int getTimezoneOffsetMinutes();
    method public long getUtcEpochSeconds();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata.Clock> CREATOR;
  }

  public abstract class RadioTuner {
    ctor public RadioTuner();
    method public abstract int cancel();
    method public abstract void cancelAnnouncement();
    method public abstract void close();
    method public abstract deprecated int getConfiguration(android.hardware.radio.RadioManager.BandConfig[]);
    method public android.hardware.radio.ProgramList getDynamicProgramList(android.hardware.radio.ProgramList.Filter);
    method public abstract boolean getMute();
    method public java.util.Map<java.lang.String, java.lang.String> getParameters(java.util.List<java.lang.String>);
    method public abstract deprecated int getProgramInformation(android.hardware.radio.RadioManager.ProgramInfo[]);
    method public abstract deprecated java.util.List<android.hardware.radio.RadioManager.ProgramInfo> getProgramList(java.util.Map<java.lang.String, java.lang.String>);
    method public abstract boolean hasControl();
    method public abstract deprecated boolean isAnalogForced();
    method public abstract deprecated boolean isAntennaConnected();
    method public boolean isConfigFlagSet(int);
    method public boolean isConfigFlagSupported(int);
    method public abstract int scan(int, boolean);
    method public abstract deprecated void setAnalogForced(boolean);
    method public void setConfigFlag(int, boolean);
    method public abstract deprecated int setConfiguration(android.hardware.radio.RadioManager.BandConfig);
    method public abstract int setMute(boolean);
    method public java.util.Map<java.lang.String, java.lang.String> setParameters(java.util.Map<java.lang.String, java.lang.String>);
    method public abstract boolean startBackgroundScan();
    method public abstract int step(int, boolean);
    method public abstract deprecated int tune(int, int);
    method public abstract void tune(android.hardware.radio.ProgramSelector);
    field public static final int DIRECTION_DOWN = 1; // 0x1
    field public static final int DIRECTION_UP = 0; // 0x0
    field public static final deprecated int ERROR_BACKGROUND_SCAN_FAILED = 6; // 0x6
    field public static final deprecated int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5; // 0x5
    field public static final deprecated int ERROR_CANCELLED = 2; // 0x2
    field public static final deprecated int ERROR_CONFIG = 4; // 0x4
    field public static final deprecated int ERROR_HARDWARE_FAILURE = 0; // 0x0
    field public static final deprecated int ERROR_SCAN_TIMEOUT = 3; // 0x3
    field public static final deprecated int ERROR_SERVER_DIED = 1; // 0x1
  }

  public static abstract class RadioTuner.Callback {
    ctor public RadioTuner.Callback();
    method public void onAntennaState(boolean);
    method public void onBackgroundScanAvailabilityChange(boolean);
    method public void onBackgroundScanComplete();
    method public deprecated void onConfigurationChanged(android.hardware.radio.RadioManager.BandConfig);
    method public void onControlChanged(boolean);
    method public void onEmergencyAnnouncement(boolean);
    method public deprecated void onError(int);
    method public deprecated void onMetadataChanged(android.hardware.radio.RadioMetadata);
    method public void onParametersUpdated(java.util.Map<java.lang.String, java.lang.String>);
    method public void onProgramInfoChanged(android.hardware.radio.RadioManager.ProgramInfo);
    method public void onProgramListChanged();
    method public void onTrafficAnnouncement(boolean);
    method public void onTuneFailed(int, android.hardware.radio.ProgramSelector);
  }

}

package android.hardware.soundtrigger {

  public class SoundTrigger {
    field public static final int STATUS_OK = 0; // 0x0
  }

  public static class SoundTrigger.RecognitionEvent {
    method public android.media.AudioFormat getCaptureFormat();
    method public int getCaptureSession();
    method public byte[] getData();
    method public boolean isCaptureAvailable();
  }

}

package android.hardware.usb {

  public class UsbDeviceConnection {
    method public boolean resetDevice();
  }

  public class UsbManager {
    method public void grantPermission(android.hardware.usb.UsbDevice, java.lang.String);
  }

}

package android.location {

  public abstract class BatchedLocationCallback {
    ctor public BatchedLocationCallback();
    method public void onLocationBatch(java.util.List<android.location.Location>);
  }

  public class GpsClock implements android.os.Parcelable {
    method public int describeContents();
    method public double getBiasInNs();
    method public double getBiasUncertaintyInNs();
    method public double getDriftInNsPerSec();
    method public double getDriftUncertaintyInNsPerSec();
    method public long getFullBiasInNs();
    method public short getLeapSecond();
    method public long getTimeInNs();
    method public double getTimeUncertaintyInNs();
    method public byte getType();
    method public boolean hasBiasInNs();
    method public boolean hasBiasUncertaintyInNs();
    method public boolean hasDriftInNsPerSec();
    method public boolean hasDriftUncertaintyInNsPerSec();
    method public boolean hasFullBiasInNs();
    method public boolean hasLeapSecond();
    method public boolean hasTimeUncertaintyInNs();
    method public void reset();
    method public void resetBiasInNs();
    method public void resetBiasUncertaintyInNs();
    method public void resetDriftInNsPerSec();
    method public void resetDriftUncertaintyInNsPerSec();
    method public void resetFullBiasInNs();
    method public void resetLeapSecond();
    method public void resetTimeUncertaintyInNs();
    method public void set(android.location.GpsClock);
    method public void setBiasInNs(double);
    method public void setBiasUncertaintyInNs(double);
    method public void setDriftInNsPerSec(double);
    method public void setDriftUncertaintyInNsPerSec(double);
    method public void setFullBiasInNs(long);
    method public void setLeapSecond(short);
    method public void setTimeInNs(long);
    method public void setTimeUncertaintyInNs(double);
    method public void setType(byte);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
    field public static final byte TYPE_GPS_TIME = 2; // 0x2
    field public static final byte TYPE_LOCAL_HW_TIME = 1; // 0x1
    field public static final byte TYPE_UNKNOWN = 0; // 0x0
  }

  public class GpsMeasurement implements android.os.Parcelable {
    method public int describeContents();
    method public double getAccumulatedDeltaRangeInMeters();
    method public short getAccumulatedDeltaRangeState();
    method public double getAccumulatedDeltaRangeUncertaintyInMeters();
    method public double getAzimuthInDeg();
    method public double getAzimuthUncertaintyInDeg();
    method public int getBitNumber();
    method public long getCarrierCycles();
    method public float getCarrierFrequencyInHz();
    method public double getCarrierPhase();
    method public double getCarrierPhaseUncertainty();
    method public double getCn0InDbHz();
    method public double getCodePhaseInChips();
    method public double getCodePhaseUncertaintyInChips();
    method public double getDopplerShiftInHz();
    method public double getDopplerShiftUncertaintyInHz();
    method public double getElevationInDeg();
    method public double getElevationUncertaintyInDeg();
    method public byte getLossOfLock();
    method public byte getMultipathIndicator();
    method public byte getPrn();
    method public double getPseudorangeInMeters();
    method public double getPseudorangeRateInMetersPerSec();
    method public double getPseudorangeRateUncertaintyInMetersPerSec();
    method public double getPseudorangeUncertaintyInMeters();
    method public long getReceivedGpsTowInNs();
    method public long getReceivedGpsTowUncertaintyInNs();
    method public double getSnrInDb();
    method public short getState();
    method public short getTimeFromLastBitInMs();
    method public double getTimeOffsetInNs();
    method public boolean hasAzimuthInDeg();
    method public boolean hasAzimuthUncertaintyInDeg();
    method public boolean hasBitNumber();
    method public boolean hasCarrierCycles();
    method public boolean hasCarrierFrequencyInHz();
    method public boolean hasCarrierPhase();
    method public boolean hasCarrierPhaseUncertainty();
    method public boolean hasCodePhaseInChips();
    method public boolean hasCodePhaseUncertaintyInChips();
    method public boolean hasDopplerShiftInHz();
    method public boolean hasDopplerShiftUncertaintyInHz();
    method public boolean hasElevationInDeg();
    method public boolean hasElevationUncertaintyInDeg();
    method public boolean hasPseudorangeInMeters();
    method public boolean hasPseudorangeUncertaintyInMeters();
    method public boolean hasSnrInDb();
    method public boolean hasTimeFromLastBitInMs();
    method public boolean isPseudorangeRateCorrected();
    method public boolean isUsedInFix();
    method public void reset();
    method public void resetAzimuthInDeg();
    method public void resetAzimuthUncertaintyInDeg();
    method public void resetBitNumber();
    method public void resetCarrierCycles();
    method public void resetCarrierFrequencyInHz();
    method public void resetCarrierPhase();
    method public void resetCarrierPhaseUncertainty();
    method public void resetCodePhaseInChips();
    method public void resetCodePhaseUncertaintyInChips();
    method public void resetDopplerShiftInHz();
    method public void resetDopplerShiftUncertaintyInHz();
    method public void resetElevationInDeg();
    method public void resetElevationUncertaintyInDeg();
    method public void resetPseudorangeInMeters();
    method public void resetPseudorangeUncertaintyInMeters();
    method public void resetSnrInDb();
    method public void resetTimeFromLastBitInMs();
    method public void set(android.location.GpsMeasurement);
    method public void setAccumulatedDeltaRangeInMeters(double);
    method public void setAccumulatedDeltaRangeState(short);
    method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
    method public void setAzimuthInDeg(double);
    method public void setAzimuthUncertaintyInDeg(double);
    method public void setBitNumber(int);
    method public void setCarrierCycles(long);
    method public void setCarrierFrequencyInHz(float);
    method public void setCarrierPhase(double);
    method public void setCarrierPhaseUncertainty(double);
    method public void setCn0InDbHz(double);
    method public void setCodePhaseInChips(double);
    method public void setCodePhaseUncertaintyInChips(double);
    method public void setDopplerShiftInHz(double);
    method public void setDopplerShiftUncertaintyInHz(double);
    method public void setElevationInDeg(double);
    method public void setElevationUncertaintyInDeg(double);
    method public void setLossOfLock(byte);
    method public void setMultipathIndicator(byte);
    method public void setPrn(byte);
    method public void setPseudorangeInMeters(double);
    method public void setPseudorangeRateInMetersPerSec(double);
    method public void setPseudorangeRateUncertaintyInMetersPerSec(double);
    method public void setPseudorangeUncertaintyInMeters(double);
    method public void setReceivedGpsTowInNs(long);
    method public void setReceivedGpsTowUncertaintyInNs(long);
    method public void setSnrInDb(double);
    method public void setState(short);
    method public void setTimeFromLastBitInMs(short);
    method public void setTimeOffsetInNs(double);
    method public void setUsedInFix(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final short ADR_STATE_CYCLE_SLIP = 4; // 0x4
    field public static final short ADR_STATE_RESET = 2; // 0x2
    field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
    field public static final short ADR_STATE_VALID = 1; // 0x1
    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
    field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
    field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
    field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
    field public static final byte MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
    field public static final byte MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
    field public static final byte MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
    field public static final short STATE_BIT_SYNC = 2; // 0x2
    field public static final short STATE_CODE_LOCK = 1; // 0x1
    field public static final short STATE_MSEC_AMBIGUOUS = 16; // 0x10
    field public static final short STATE_SUBFRAME_SYNC = 4; // 0x4
    field public static final short STATE_TOW_DECODED = 8; // 0x8
    field public static final short STATE_UNKNOWN = 0; // 0x0
  }

  public class GpsMeasurementsEvent implements android.os.Parcelable {
    ctor public GpsMeasurementsEvent(android.location.GpsClock, android.location.GpsMeasurement[]);
    method public int describeContents();
    method public android.location.GpsClock getClock();
    method public java.util.Collection<android.location.GpsMeasurement> getMeasurements();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurementsEvent> CREATOR;
    field public static final int STATUS_GPS_LOCATION_DISABLED = 2; // 0x2
    field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
    field public static final int STATUS_READY = 1; // 0x1
  }

  public static abstract interface GpsMeasurementsEvent.Listener {
    method public abstract void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
    method public abstract void onStatusChanged(int);
  }

  public class GpsNavigationMessage implements android.os.Parcelable {
    method public int describeContents();
    method public byte[] getData();
    method public short getMessageId();
    method public byte getPrn();
    method public short getStatus();
    method public short getSubmessageId();
    method public byte getType();
    method public void reset();
    method public void set(android.location.GpsNavigationMessage);
    method public void setData(byte[]);
    method public void setMessageId(short);
    method public void setPrn(byte);
    method public void setStatus(short);
    method public void setSubmessageId(short);
    method public void setType(byte);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
    field public static final short STATUS_PARITY_PASSED = 1; // 0x1
    field public static final short STATUS_PARITY_REBUILT = 2; // 0x2
    field public static final short STATUS_UNKNOWN = 0; // 0x0
    field public static final byte TYPE_CNAV2 = 4; // 0x4
    field public static final byte TYPE_L1CA = 1; // 0x1
    field public static final byte TYPE_L2CNAV = 2; // 0x2
    field public static final byte TYPE_L5CNAV = 3; // 0x3
    field public static final byte TYPE_UNKNOWN = 0; // 0x0
  }

  public class GpsNavigationMessageEvent implements android.os.Parcelable {
    ctor public GpsNavigationMessageEvent(android.location.GpsNavigationMessage);
    method public int describeContents();
    method public android.location.GpsNavigationMessage getNavigationMessage();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
    field public static int STATUS_GPS_LOCATION_DISABLED;
    field public static int STATUS_NOT_SUPPORTED;
    field public static int STATUS_READY;
  }

  public static abstract interface GpsNavigationMessageEvent.Listener {
    method public abstract void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
    method public abstract void onStatusChanged(int);
  }

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

  public class LocationManager {
    method public deprecated boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
    method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
    method public void flushGnssBatch();
    method public int getGnssBatchSize();
    method public boolean isLocationEnabledForUser(android.os.UserHandle);
    method public boolean isProviderEnabledForUser(java.lang.String, android.os.UserHandle);
    method public boolean registerGnssBatchedLocationCallback(long, boolean, android.location.BatchedLocationCallback, android.os.Handler);
    method public deprecated void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
    method public deprecated void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
    method public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
    method public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
    method public void setLocationEnabledForUser(boolean, android.os.UserHandle);
    method public boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle);
    method public boolean unregisterGnssBatchedLocationCallback(android.location.BatchedLocationCallback);
  }

  public final class LocationRequest implements android.os.Parcelable {
    method public static android.location.LocationRequest create();
    method public static android.location.LocationRequest createFromDeprecatedCriteria(android.location.Criteria, long, float, boolean);
    method public static android.location.LocationRequest createFromDeprecatedProvider(java.lang.String, long, float, boolean);
    method public int describeContents();
    method public long getExpireAt();
    method public long getFastestInterval();
    method public boolean getHideFromAppOps();
    method public long getInterval();
    method public int getNumUpdates();
    method public java.lang.String getProvider();
    method public int getQuality();
    method public float getSmallestDisplacement();
    method public android.os.WorkSource getWorkSource();
    method public boolean isLowPowerMode();
    method public android.location.LocationRequest setExpireAt(long);
    method public android.location.LocationRequest setExpireIn(long);
    method public android.location.LocationRequest setFastestInterval(long);
    method public void setHideFromAppOps(boolean);
    method public android.location.LocationRequest setInterval(long);
    method public android.location.LocationRequest setLowPowerMode(boolean);
    method public android.location.LocationRequest setNumUpdates(int);
    method public android.location.LocationRequest setProvider(java.lang.String);
    method public android.location.LocationRequest setQuality(int);
    method public android.location.LocationRequest setSmallestDisplacement(float);
    method public void setWorkSource(android.os.WorkSource);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACCURACY_BLOCK = 102; // 0x66
    field public static final int ACCURACY_CITY = 104; // 0x68
    field public static final int ACCURACY_FINE = 100; // 0x64
    field public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
    field public static final int POWER_HIGH = 203; // 0xcb
    field public static final int POWER_LOW = 201; // 0xc9
    field public static final int POWER_NONE = 200; // 0xc8
  }

}

package android.media {

  public final class AudioAttributes implements android.os.Parcelable {
    method public int getAllFlags();
    method public android.os.Bundle getBundle();
    method public int getCapturePreset();
    field public static final int FLAG_BEACON = 8; // 0x8
    field public static final int FLAG_BYPASS_INTERRUPTION_POLICY = 64; // 0x40
    field public static final int FLAG_BYPASS_MUTE = 128; // 0x80
    field public static final int FLAG_HW_HOTWORD = 32; // 0x20
  }

  public static class AudioAttributes.Builder {
    method public android.media.AudioAttributes.Builder addBundle(android.os.Bundle);
    method public android.media.AudioAttributes.Builder setCapturePreset(int);
    method public android.media.AudioAttributes.Builder setInternalCapturePreset(int);
  }

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

  public final class AudioFocusRequest {
    method public boolean locksFocus();
  }

  public static final class AudioFocusRequest.Builder {
    method public android.media.AudioFocusRequest.Builder setLocksFocus(boolean);
  }

  public class AudioManager {
    method public deprecated int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes);
    method public void clearAudioServerStateCallback();
    method public int dispatchAudioFocusChange(android.media.AudioFocusInfo, int, android.media.audiopolicy.AudioPolicy);
    method public boolean isAudioServerRunning();
    method public boolean isHdmiSystemAudioSupported();
    method public int registerAudioPolicy(android.media.audiopolicy.AudioPolicy);
    method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes, int, int) throws java.lang.IllegalArgumentException;
    method public deprecated int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes, int, int, android.media.audiopolicy.AudioPolicy) throws java.lang.IllegalArgumentException;
    method public int requestAudioFocus(android.media.AudioFocusRequest, android.media.audiopolicy.AudioPolicy);
    method public void setAudioServerStateCallback(java.util.concurrent.Executor, android.media.AudioManager.AudioServerStateCallback);
    method public void setFocusRequestResult(android.media.AudioFocusInfo, int, android.media.audiopolicy.AudioPolicy);
    method public void unregisterAudioPolicyAsync(android.media.audiopolicy.AudioPolicy);
    field public static final int AUDIOFOCUS_FLAG_DELAY_OK = 1; // 0x1
    field public static final int AUDIOFOCUS_FLAG_LOCK = 4; // 0x4
    field public static final int AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS = 2; // 0x2
  }

  public static abstract class AudioManager.AudioServerStateCallback {
    ctor public AudioManager.AudioServerStateCallback();
    method public void onAudioServerDown();
    method public void onAudioServerUp();
  }

  public final class AudioPlaybackConfiguration implements android.os.Parcelable {
    method public int getClientPid();
    method public int getClientUid();
    method public int getPlayerInterfaceId();
    method public android.media.PlayerProxy getPlayerProxy();
    method public int getPlayerState();
    method public int getPlayerType();
    field public static final int PLAYER_STATE_IDLE = 1; // 0x1
    field public static final int PLAYER_STATE_PAUSED = 3; // 0x3
    field public static final int PLAYER_STATE_RELEASED = 0; // 0x0
    field public static final int PLAYER_STATE_STARTED = 2; // 0x2
    field public static final int PLAYER_STATE_STOPPED = 4; // 0x4
    field public static final int PLAYER_STATE_UNKNOWN = -1; // 0xffffffff
    field public static final int PLAYER_TYPE_JAM_AUDIOTRACK = 1; // 0x1
    field public static final int PLAYER_TYPE_JAM_MEDIAPLAYER = 2; // 0x2
    field public static final int PLAYER_TYPE_JAM_SOUNDPOOL = 3; // 0x3
    field public static final int PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11; // 0xb
    field public static final int PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12; // 0xc
    field public static final int PLAYER_TYPE_UNKNOWN = -1; // 0xffffffff
  }

  public class AudioRecord implements android.media.AudioRouting {
    ctor public AudioRecord(android.media.AudioAttributes, android.media.AudioFormat, int, int) throws java.lang.IllegalArgumentException;
  }

  public static class AudioRecord.Builder {
    method public android.media.AudioRecord.Builder setAudioAttributes(android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
    method public android.media.AudioRecord.Builder setSessionId(int) throws java.lang.IllegalArgumentException;
  }

  public final class MediaRecorder.AudioSource {
    field public static final int HOTWORD = 1999; // 0x7cf
    field public static final int RADIO_TUNER = 1998; // 0x7ce
  }

  public class PlayerProxy {
    method public void pause();
    method public void setPan(float);
    method public void setStartDelayMs(int);
    method public void setVolume(float);
    method public void start();
    method public void stop();
  }

}

package android.media.audiopolicy {

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

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

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

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

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

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

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

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

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

}

package android.media.session {

  public final class MediaSessionManager {
    method public void setOnMediaKeyListener(android.media.session.MediaSessionManager.OnMediaKeyListener, android.os.Handler);
    method public void setOnVolumeKeyLongPressListener(android.media.session.MediaSessionManager.OnVolumeKeyLongPressListener, android.os.Handler);
  }

  public static abstract interface MediaSessionManager.OnMediaKeyListener {
    method public abstract boolean onMediaKey(android.view.KeyEvent);
  }

  public static abstract interface MediaSessionManager.OnVolumeKeyLongPressListener {
    method public abstract void onVolumeKeyLongPress(android.view.KeyEvent);
  }

}

package android.media.soundtrigger {

  public abstract class SoundTriggerDetectionService extends android.app.Service {
    ctor public SoundTriggerDetectionService();
    method public void onConnected(java.util.UUID, android.os.Bundle);
    method public void onDisconnected(java.util.UUID, android.os.Bundle);
    method public void onError(java.util.UUID, android.os.Bundle, int, int);
    method public void onGenericRecognitionEvent(java.util.UUID, android.os.Bundle, int, android.hardware.soundtrigger.SoundTrigger.RecognitionEvent);
    method public abstract void onStopOperation(java.util.UUID, android.os.Bundle, int);
    method public final void operationFinished(java.util.UUID, int);
  }

  public final class SoundTriggerDetector {
    method public boolean startRecognition(int);
    method public boolean stopRecognition();
    field public static final int RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS = 2; // 0x2
    field public static final int RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO = 1; // 0x1
  }

  public static abstract class SoundTriggerDetector.Callback {
    ctor public SoundTriggerDetector.Callback();
    method public abstract void onAvailabilityChanged(int);
    method public abstract void onDetected(android.media.soundtrigger.SoundTriggerDetector.EventPayload);
    method public abstract void onError();
    method public abstract void onRecognitionPaused();
    method public abstract void onRecognitionResumed();
  }

  public static class SoundTriggerDetector.EventPayload {
    method public android.media.AudioFormat getCaptureAudioFormat();
    method public byte[] getTriggerAudio();
  }

  public final class SoundTriggerManager {
    method public android.media.soundtrigger.SoundTriggerDetector createSoundTriggerDetector(java.util.UUID, android.media.soundtrigger.SoundTriggerDetector.Callback, android.os.Handler);
    method public void deleteModel(java.util.UUID);
    method public int getDetectionServiceOperationsTimeout();
    method public android.media.soundtrigger.SoundTriggerManager.Model getModel(java.util.UUID);
    method public void updateModel(android.media.soundtrigger.SoundTriggerManager.Model);
  }

  public static class SoundTriggerManager.Model {
    method public static android.media.soundtrigger.SoundTriggerManager.Model create(java.util.UUID, java.util.UUID, byte[]);
    method public byte[] getModelData();
    method public java.util.UUID getModelUuid();
    method public java.util.UUID getVendorUuid();
  }

}

package android.media.tv {

  public final class TvContentRatingSystemInfo implements android.os.Parcelable {
    method public static android.media.tv.TvContentRatingSystemInfo createTvContentRatingSystemInfo(int, android.content.pm.ApplicationInfo);
    method public int describeContents();
    method public android.net.Uri getXmlUri();
    method public boolean isSystemDefined();
    method public void writeToParcel(android.os.Parcel, int);
  }

  public final class TvContract {
    method public static android.net.Uri buildChannelsUriForInput(java.lang.String, boolean);
    method public static android.net.Uri buildChannelsUriForInput(java.lang.String, java.lang.String, boolean);
    field public static final java.lang.String ACTION_CHANNEL_BROWSABLE_REQUESTED = "android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED";
    field public static final java.lang.String EXTRA_BLOCKED_PACKAGES = "android.media.tv.extra.BLOCKED_PACKAGES";
    field public static final java.lang.String EXTRA_COLUMN_NAME = "android.media.tv.extra.COLUMN_NAME";
    field public static final java.lang.String EXTRA_DATA_TYPE = "android.media.tv.extra.DATA_TYPE";
    field public static final java.lang.String EXTRA_DEFAULT_VALUE = "android.media.tv.extra.DEFAULT_VALUE";
    field public static final java.lang.String EXTRA_EXISTING_COLUMN_NAMES = "android.media.tv.extra.EXISTING_COLUMN_NAMES";
    field public static final java.lang.String EXTRA_PACKAGE_NAME = "android.media.tv.extra.PACKAGE_NAME";
    field public static final java.lang.String EXTRA_RESULT_CODE = "android.media.tv.extra.RESULT_CODE";
    field public static final java.lang.String METHOD_ADD_COLUMN = "add_column";
    field public static final java.lang.String METHOD_BLOCK_PACKAGE = "block_package";
    field public static final java.lang.String METHOD_GET_BLOCKED_PACKAGES = "get_blocked_packages";
    field public static final java.lang.String METHOD_GET_COLUMNS = "get_columns";
    field public static final java.lang.String METHOD_UNBLOCK_PACKAGE = "unblock_package";
    field public static final int RESULT_ERROR_INVALID_ARGUMENT = 2; // 0x2
    field public static final int RESULT_ERROR_IO = 1; // 0x1
    field public static final int RESULT_OK = 0; // 0x0
  }

  public static final class TvContract.WatchedPrograms implements android.media.tv.TvContract.BaseTvColumns {
    field public static final java.lang.String COLUMN_CHANNEL_ID = "channel_id";
    field public static final java.lang.String COLUMN_DESCRIPTION = "description";
    field public static final java.lang.String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
    field public static final java.lang.String COLUMN_INTERNAL_SESSION_TOKEN = "session_token";
    field public static final java.lang.String COLUMN_INTERNAL_TUNE_PARAMS = "tune_params";
    field public static final java.lang.String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_WATCH_END_TIME_UTC_MILLIS = "watch_end_time_utc_millis";
    field public static final java.lang.String COLUMN_WATCH_START_TIME_UTC_MILLIS = "watch_start_time_utc_millis";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/watched_program";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/watched_program";
    field public static final android.net.Uri CONTENT_URI;
  }

  public final class TvInputHardwareInfo implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.String getAudioAddress();
    method public int getAudioType();
    method public int getCableConnectionStatus();
    method public int getDeviceId();
    method public int getHdmiPortId();
    method public int getType();
    method public void readFromParcel(android.os.Parcel);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CABLE_CONNECTION_STATUS_CONNECTED = 1; // 0x1
    field public static final int CABLE_CONNECTION_STATUS_DISCONNECTED = 2; // 0x2
    field public static final int CABLE_CONNECTION_STATUS_UNKNOWN = 0; // 0x0
    field public static final android.os.Parcelable.Creator<android.media.tv.TvInputHardwareInfo> CREATOR;
    field public static final int TV_INPUT_TYPE_COMPONENT = 6; // 0x6
    field public static final int TV_INPUT_TYPE_COMPOSITE = 3; // 0x3
    field public static final int TV_INPUT_TYPE_DISPLAY_PORT = 10; // 0xa
    field public static final int TV_INPUT_TYPE_DVI = 8; // 0x8
    field public static final int TV_INPUT_TYPE_HDMI = 9; // 0x9
    field public static final int TV_INPUT_TYPE_OTHER_HARDWARE = 1; // 0x1
    field public static final int TV_INPUT_TYPE_SCART = 5; // 0x5
    field public static final int TV_INPUT_TYPE_SVIDEO = 4; // 0x4
    field public static final int TV_INPUT_TYPE_TUNER = 2; // 0x2
    field public static final int TV_INPUT_TYPE_VGA = 7; // 0x7
  }

  public static final class TvInputHardwareInfo.Builder {
    ctor public TvInputHardwareInfo.Builder();
    method public android.media.tv.TvInputHardwareInfo.Builder audioAddress(java.lang.String);
    method public android.media.tv.TvInputHardwareInfo.Builder audioType(int);
    method public android.media.tv.TvInputHardwareInfo build();
    method public android.media.tv.TvInputHardwareInfo.Builder cableConnectionStatus(int);
    method public android.media.tv.TvInputHardwareInfo.Builder deviceId(int);
    method public android.media.tv.TvInputHardwareInfo.Builder hdmiPortId(int);
    method public android.media.tv.TvInputHardwareInfo.Builder type(int);
  }

  public final class TvInputInfo implements android.os.Parcelable {
    method public static deprecated android.media.tv.TvInputInfo createTvInputInfo(android.content.Context, android.content.pm.ResolveInfo, android.hardware.hdmi.HdmiDeviceInfo, java.lang.String, java.lang.String, android.net.Uri) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public static deprecated android.media.tv.TvInputInfo createTvInputInfo(android.content.Context, android.content.pm.ResolveInfo, android.hardware.hdmi.HdmiDeviceInfo, java.lang.String, int, android.graphics.drawable.Icon) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public static deprecated android.media.tv.TvInputInfo createTvInputInfo(android.content.Context, android.content.pm.ResolveInfo, android.media.tv.TvInputHardwareInfo, java.lang.String, android.net.Uri) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public static deprecated android.media.tv.TvInputInfo createTvInputInfo(android.content.Context, android.content.pm.ResolveInfo, android.media.tv.TvInputHardwareInfo, int, android.graphics.drawable.Icon) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public android.hardware.hdmi.HdmiDeviceInfo getHdmiDeviceInfo();
    method public boolean isConnectedToHdmiSwitch();
    method public boolean isHardwareInput();
    method public android.graphics.drawable.Drawable loadIcon(android.content.Context, int);
  }

  public static final class TvInputInfo.Builder {
    method public android.media.tv.TvInputInfo.Builder setHdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon);
    method public android.media.tv.TvInputInfo.Builder setIcon(android.graphics.drawable.Icon, int);
    method public android.media.tv.TvInputInfo.Builder setLabel(java.lang.CharSequence);
    method public android.media.tv.TvInputInfo.Builder setLabel(int);
    method public android.media.tv.TvInputInfo.Builder setParentId(java.lang.String);
    method public android.media.tv.TvInputInfo.Builder setTvInputHardwareInfo(android.media.tv.TvInputHardwareInfo);
  }

  public static final class TvInputInfo.TvInputSettings {
    method public static java.util.Map<java.lang.String, java.lang.String> getCustomLabels(android.content.Context, int);
    method public static java.util.Set<java.lang.String> getHiddenTvInputIds(android.content.Context, int);
    method public static void putCustomLabels(android.content.Context, java.util.Map<java.lang.String, java.lang.String>, int);
    method public static void putHiddenTvInputs(android.content.Context, java.util.Set<java.lang.String>, int);
  }

  public final class TvInputManager {
    method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputInfo, android.media.tv.TvInputManager.HardwareCallback);
    method public void addBlockedRating(android.media.tv.TvContentRating);
    method public boolean captureFrame(java.lang.String, android.view.Surface, android.media.tv.TvStreamConfig);
    method public java.util.List<android.media.tv.TvStreamConfig> getAvailableTvStreamConfigList(java.lang.String);
    method public java.util.List<android.media.tv.TvContentRating> getBlockedRatings();
    method public java.util.List<android.media.tv.TvInputHardwareInfo> getHardwareList();
    method public java.util.List<android.media.tv.TvContentRatingSystemInfo> getTvContentRatingSystemList();
    method public boolean isSingleSessionActive();
    method public void notifyPreviewProgramAddedToWatchNext(java.lang.String, long, long);
    method public void notifyPreviewProgramBrowsableDisabled(java.lang.String, long);
    method public void notifyWatchNextProgramBrowsableDisabled(java.lang.String, long);
    method public void releaseTvInputHardware(int, android.media.tv.TvInputManager.Hardware);
    method public void removeBlockedRating(android.media.tv.TvContentRating);
    method public void setParentalControlsEnabled(boolean);
  }

  public static final class TvInputManager.Hardware {
    method public void overrideAudioSink(int, java.lang.String, int, int, int);
    method public void setStreamVolume(float);
    method public boolean setSurface(android.view.Surface, android.media.tv.TvStreamConfig);
  }

  public static abstract class TvInputManager.HardwareCallback {
    ctor public TvInputManager.HardwareCallback();
    method public abstract void onReleased();
    method public abstract void onStreamConfigChanged(android.media.tv.TvStreamConfig[]);
  }

  public abstract class TvInputService extends android.app.Service {
    method public android.media.tv.TvInputInfo onHardwareAdded(android.media.tv.TvInputHardwareInfo);
    method public java.lang.String onHardwareRemoved(android.media.tv.TvInputHardwareInfo);
    method public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo);
    method public java.lang.String onHdmiDeviceRemoved(android.hardware.hdmi.HdmiDeviceInfo);
  }

  public static abstract class TvInputService.RecordingSession {
    method public void notifySessionEvent(java.lang.String, android.os.Bundle);
  }

  public static abstract class TvInputService.Session implements android.view.KeyEvent.Callback {
    method public void notifySessionEvent(java.lang.String, android.os.Bundle);
    method public void onSetMain(boolean);
  }

  public static abstract class TvRecordingClient.RecordingCallback {
    method public void onEvent(java.lang.String, java.lang.String, android.os.Bundle);
  }

  public class TvStreamConfig implements android.os.Parcelable {
    method public int describeContents();
    method public int getGeneration();
    method public int getMaxHeight();
    method public int getMaxWidth();
    method public int getStreamId();
    method public int getType();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.media.tv.TvStreamConfig> CREATOR;
    field public static final int STREAM_TYPE_BUFFER_PRODUCER = 2; // 0x2
    field public static final int STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE = 1; // 0x1
  }

  public static final class TvStreamConfig.Builder {
    ctor public TvStreamConfig.Builder();
    method public android.media.tv.TvStreamConfig build();
    method public android.media.tv.TvStreamConfig.Builder generation(int);
    method public android.media.tv.TvStreamConfig.Builder maxHeight(int);
    method public android.media.tv.TvStreamConfig.Builder maxWidth(int);
    method public android.media.tv.TvStreamConfig.Builder streamId(int);
    method public android.media.tv.TvStreamConfig.Builder type(int);
  }

  public class TvView extends android.view.ViewGroup {
    method public void setMain();
    method public void unblockContent(android.media.tv.TvContentRating);
  }

  public static abstract class TvView.TvInputCallback {
    method public void onEvent(java.lang.String, java.lang.String, android.os.Bundle);
  }

}

package android.metrics {

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

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

}

package android.net {

  public class ConnectivityManager {
    method public java.lang.String getCaptivePortalServerUrl();
    method public boolean isTetheringSupported();
    method public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback);
    method public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback, android.os.Handler);
    method public void stopTethering(int);
    field public static final int TETHERING_BLUETOOTH = 2; // 0x2
    field public static final int TETHERING_USB = 1; // 0x1
    field public static final int TETHERING_WIFI = 0; // 0x0
  }

  public static abstract class ConnectivityManager.OnStartTetheringCallback {
    ctor public ConnectivityManager.OnStartTetheringCallback();
    method public void onTetheringFailed();
    method public void onTetheringStarted();
  }

  public final class IpSecManager {
    method public void applyTunnelModeTransform(android.net.IpSecManager.IpSecTunnelInterface, int, android.net.IpSecTransform) throws java.io.IOException;
    method public android.net.IpSecManager.IpSecTunnelInterface createIpSecTunnelInterface(java.net.InetAddress, java.net.InetAddress, android.net.Network) throws java.io.IOException, android.net.IpSecManager.ResourceUnavailableException;
  }

  public static final class IpSecManager.IpSecTunnelInterface implements java.lang.AutoCloseable {
    method public void addAddress(java.net.InetAddress, int) throws java.io.IOException;
    method public void close();
    method public java.lang.String getInterfaceName();
    method public void removeAddress(java.net.InetAddress, int) throws java.io.IOException;
  }

  public final class IpSecTransform implements java.lang.AutoCloseable {
    method public void startNattKeepalive(android.net.IpSecTransform.NattKeepaliveCallback, int, android.os.Handler) throws java.io.IOException;
    method public void stopNattKeepalive();
  }

  public static class IpSecTransform.Builder {
    method public android.net.IpSecTransform buildTunnelModeTransform(java.net.InetAddress, android.net.IpSecManager.SecurityParameterIndex) throws java.io.IOException, android.net.IpSecManager.ResourceUnavailableException, android.net.IpSecManager.SpiUnavailableException;
  }

  public static class IpSecTransform.NattKeepaliveCallback {
    ctor public IpSecTransform.NattKeepaliveCallback();
    method public void onError(int);
    method public void onStarted();
    method public void onStopped();
    field public static final int ERROR_HARDWARE_ERROR = 3; // 0x3
    field public static final int ERROR_HARDWARE_UNSUPPORTED = 2; // 0x2
    field public static final int ERROR_INVALID_NETWORK = 1; // 0x1
  }

  public final class NetworkCapabilities implements android.os.Parcelable {
    field public static final int NET_CAPABILITY_OEM_PAID = 22; // 0x16
  }

  public class NetworkKey implements android.os.Parcelable {
    ctor public NetworkKey(android.net.WifiKey);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.NetworkKey> CREATOR;
    field public static final int TYPE_WIFI = 1; // 0x1
    field public final int type;
    field public final android.net.WifiKey wifiKey;
  }

  public abstract class NetworkRecommendationProvider {
    ctor public NetworkRecommendationProvider(android.content.Context, java.util.concurrent.Executor);
    method public final android.os.IBinder getBinder();
    method public abstract void onRequestScores(android.net.NetworkKey[]);
  }

  public class NetworkScoreManager {
    method public boolean clearScores() throws java.lang.SecurityException;
    method public void disableScoring() throws java.lang.SecurityException;
    method public java.lang.String getActiveScorerPackage();
    method public boolean setActiveScorer(java.lang.String) throws java.lang.SecurityException;
    method public boolean updateScores(android.net.ScoredNetwork[]) throws java.lang.SecurityException;
    field public static final java.lang.String ACTION_CHANGE_ACTIVE = "android.net.scoring.CHANGE_ACTIVE";
    field public static final java.lang.String ACTION_CUSTOM_ENABLE = "android.net.scoring.CUSTOM_ENABLE";
    field public static final java.lang.String ACTION_RECOMMEND_NETWORKS = "android.net.action.RECOMMEND_NETWORKS";
    field public static final java.lang.String ACTION_SCORER_CHANGED = "android.net.scoring.SCORER_CHANGED";
    field public static final java.lang.String ACTION_SCORE_NETWORKS = "android.net.scoring.SCORE_NETWORKS";
    field public static final java.lang.String EXTRA_NETWORKS_TO_SCORE = "networksToScore";
    field public static final java.lang.String EXTRA_NEW_SCORER = "newScorer";
    field public static final java.lang.String EXTRA_PACKAGE_NAME = "packageName";
  }

  public class RssiCurve implements android.os.Parcelable {
    ctor public RssiCurve(int, int, byte[]);
    ctor public RssiCurve(int, int, byte[], int);
    method public int describeContents();
    method public byte lookupScore(int);
    method public byte lookupScore(int, boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.RssiCurve> CREATOR;
    field public final int activeNetworkRssiBoost;
    field public final int bucketWidth;
    field public final byte[] rssiBuckets;
    field public final int start;
  }

  public class ScoredNetwork implements android.os.Parcelable {
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve);
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve, boolean);
    ctor public ScoredNetwork(android.net.NetworkKey, android.net.RssiCurve, boolean, android.os.Bundle);
    method public int calculateBadge(int);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final java.lang.String ATTRIBUTES_KEY_BADGING_CURVE = "android.net.attributes.key.BADGING_CURVE";
    field public static final java.lang.String ATTRIBUTES_KEY_HAS_CAPTIVE_PORTAL = "android.net.attributes.key.HAS_CAPTIVE_PORTAL";
    field public static final java.lang.String ATTRIBUTES_KEY_RANKING_SCORE_OFFSET = "android.net.attributes.key.RANKING_SCORE_OFFSET";
    field public static final android.os.Parcelable.Creator<android.net.ScoredNetwork> CREATOR;
    field public final android.os.Bundle attributes;
    field public final boolean meteredHint;
    field public final android.net.NetworkKey networkKey;
    field public final android.net.RssiCurve rssiCurve;
  }

  public class TrafficStats {
    method public static void clearThreadStatsUid();
    method public static void setThreadStatsTagApp();
    method public static void setThreadStatsTagBackup();
    method public static void setThreadStatsTagRestore();
    method public static void setThreadStatsUid(int);
  }

  public class VpnService extends android.app.Service {
    method public static void prepareAndAuthorize(android.content.Context);
  }

  public class WebAddress {
    ctor public WebAddress(java.lang.String) throws android.net.ParseException;
  }

  public class WifiKey implements android.os.Parcelable {
    ctor public WifiKey(java.lang.String, java.lang.String);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.WifiKey> CREATOR;
    field public final java.lang.String bssid;
    field public final java.lang.String ssid;
  }

}

package android.net.http {

  public class X509TrustManagerExtensions {
    method public boolean isSameTrustConfiguration(java.lang.String, java.lang.String);
  }

}

package android.net.wifi {

  public deprecated class RttManager {
    method public void disableResponder(android.net.wifi.RttManager.ResponderCallback);
    method public void enableResponder(android.net.wifi.RttManager.ResponderCallback);
    method public deprecated android.net.wifi.RttManager.Capabilities getCapabilities();
    method public android.net.wifi.RttManager.RttCapabilities getRttCapabilities();
    method public void startRanging(android.net.wifi.RttManager.RttParams[], android.net.wifi.RttManager.RttListener);
    method public void stopRanging(android.net.wifi.RttManager.RttListener);
    field public static final int BASE = 160256; // 0x27200
    field public static final int CMD_OP_ABORTED = 160260; // 0x27204
    field public static final int CMD_OP_DISABLE_RESPONDER = 160262; // 0x27206
    field public static final int CMD_OP_ENABLE_RESPONDER = 160261; // 0x27205
    field public static final int CMD_OP_ENALBE_RESPONDER_FAILED = 160264; // 0x27208
    field public static final int CMD_OP_ENALBE_RESPONDER_SUCCEEDED = 160263; // 0x27207
    field public static final int CMD_OP_FAILED = 160258; // 0x27202
    field public static final int CMD_OP_START_RANGING = 160256; // 0x27200
    field public static final int CMD_OP_STOP_RANGING = 160257; // 0x27201
    field public static final int CMD_OP_SUCCEEDED = 160259; // 0x27203
    field public static final java.lang.String DESCRIPTION_KEY = "android.net.wifi.RttManager.Description";
    field public static final int PREAMBLE_HT = 2; // 0x2
    field public static final int PREAMBLE_LEGACY = 1; // 0x1
    field public static final int PREAMBLE_VHT = 4; // 0x4
    field public static final int REASON_INITIATOR_NOT_ALLOWED_WHEN_RESPONDER_ON = -6; // 0xfffffffa
    field public static final int REASON_INVALID_LISTENER = -3; // 0xfffffffd
    field public static final int REASON_INVALID_REQUEST = -4; // 0xfffffffc
    field public static final int REASON_NOT_AVAILABLE = -2; // 0xfffffffe
    field public static final int REASON_PERMISSION_DENIED = -5; // 0xfffffffb
    field public static final int REASON_UNSPECIFIED = -1; // 0xffffffff
    field public static final int RTT_BW_10_SUPPORT = 2; // 0x2
    field public static final int RTT_BW_160_SUPPORT = 32; // 0x20
    field public static final int RTT_BW_20_SUPPORT = 4; // 0x4
    field public static final int RTT_BW_40_SUPPORT = 8; // 0x8
    field public static final int RTT_BW_5_SUPPORT = 1; // 0x1
    field public static final int RTT_BW_80_SUPPORT = 16; // 0x10
    field public static final deprecated int RTT_CHANNEL_WIDTH_10 = 6; // 0x6
    field public static final deprecated int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
    field public static final deprecated int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
    field public static final deprecated int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
    field public static final deprecated int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
    field public static final deprecated int RTT_CHANNEL_WIDTH_80 = 2; // 0x2
    field public static final deprecated int RTT_CHANNEL_WIDTH_80P80 = 4; // 0x4
    field public static final deprecated int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1; // 0xffffffff
    field public static final int RTT_PEER_NAN = 5; // 0x5
    field public static final int RTT_PEER_P2P_CLIENT = 4; // 0x4
    field public static final int RTT_PEER_P2P_GO = 3; // 0x3
    field public static final int RTT_PEER_TYPE_AP = 1; // 0x1
    field public static final int RTT_PEER_TYPE_STA = 2; // 0x2
    field public static final deprecated int RTT_PEER_TYPE_UNSPECIFIED = 0; // 0x0
    field public static final int RTT_STATUS_ABORTED = 8; // 0x8
    field public static final int RTT_STATUS_FAILURE = 1; // 0x1
    field public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6; // 0x6
    field public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12; // 0xc
    field public static final int RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = 15; // 0xf
    field public static final int RTT_STATUS_FAIL_INVALID_TS = 9; // 0x9
    field public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4; // 0x4
    field public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7; // 0x7
    field public static final int RTT_STATUS_FAIL_NO_RSP = 2; // 0x2
    field public static final int RTT_STATUS_FAIL_PROTOCOL = 10; // 0xa
    field public static final int RTT_STATUS_FAIL_REJECTED = 3; // 0x3
    field public static final int RTT_STATUS_FAIL_SCHEDULE = 11; // 0xb
    field public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5; // 0x5
    field public static final int RTT_STATUS_INVALID_REQ = 13; // 0xd
    field public static final int RTT_STATUS_NO_WIFI = 14; // 0xe
    field public static final int RTT_STATUS_SUCCESS = 0; // 0x0
    field public static final deprecated int RTT_TYPE_11_MC = 4; // 0x4
    field public static final deprecated int RTT_TYPE_11_V = 2; // 0x2
    field public static final int RTT_TYPE_ONE_SIDED = 1; // 0x1
    field public static final int RTT_TYPE_TWO_SIDED = 2; // 0x2
    field public static final deprecated int RTT_TYPE_UNSPECIFIED = 0; // 0x0
  }

  public deprecated class RttManager.Capabilities {
    ctor public RttManager.Capabilities();
    field public int supportedPeerType;
    field public int supportedType;
  }

  public static deprecated class RttManager.ParcelableRttParams implements android.os.Parcelable {
    field public android.net.wifi.RttManager.RttParams[] mParams;
  }

  public static deprecated class RttManager.ParcelableRttResults implements android.os.Parcelable {
    ctor public RttManager.ParcelableRttResults(android.net.wifi.RttManager.RttResult[]);
    field public android.net.wifi.RttManager.RttResult[] mResults;
  }

  public static abstract deprecated class RttManager.ResponderCallback {
    ctor public RttManager.ResponderCallback();
    method public abstract void onResponderEnableFailure(int);
    method public abstract void onResponderEnabled(android.net.wifi.RttManager.ResponderConfig);
  }

  public static deprecated class RttManager.ResponderConfig implements android.os.Parcelable {
    ctor public RttManager.ResponderConfig();
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.wifi.RttManager.ResponderConfig> CREATOR;
    field public int centerFreq0;
    field public int centerFreq1;
    field public int channelWidth;
    field public int frequency;
    field public java.lang.String macAddress;
    field public int preamble;
  }

  public static deprecated class RttManager.RttCapabilities implements android.os.Parcelable {
    ctor public RttManager.RttCapabilities();
    field public int bwSupported;
    field public boolean lciSupported;
    field public boolean lcrSupported;
    field public int mcVersion;
    field public boolean oneSidedRttSupported;
    field public int preambleSupported;
    field public boolean responderSupported;
    field public boolean secureRttSupported;
    field public deprecated boolean supportedPeerType;
    field public deprecated boolean supportedType;
    field public boolean twoSided11McRttSupported;
  }

  public static abstract deprecated interface RttManager.RttListener {
    method public abstract void onAborted();
    method public abstract void onFailure(int, java.lang.String);
    method public abstract void onSuccess(android.net.wifi.RttManager.RttResult[]);
  }

  public static deprecated class RttManager.RttParams {
    ctor public RttManager.RttParams();
    field public boolean LCIRequest;
    field public boolean LCRRequest;
    field public int bandwidth;
    field public java.lang.String bssid;
    field public int burstTimeout;
    field public int centerFreq0;
    field public int centerFreq1;
    field public int channelWidth;
    field public int deviceType;
    field public int frequency;
    field public int interval;
    field public int numRetriesPerFTMR;
    field public int numRetriesPerMeasurementFrame;
    field public int numSamplesPerBurst;
    field public deprecated int num_retries;
    field public deprecated int num_samples;
    field public int numberBurst;
    field public int preamble;
    field public int requestType;
    field public boolean secure;
  }

  public static deprecated class RttManager.RttResult {
    ctor public RttManager.RttResult();
    field public android.net.wifi.RttManager.WifiInformationElement LCI;
    field public android.net.wifi.RttManager.WifiInformationElement LCR;
    field public java.lang.String bssid;
    field public int burstDuration;
    field public int burstNumber;
    field public int distance;
    field public int distanceSpread;
    field public int distanceStandardDeviation;
    field public deprecated int distance_cm;
    field public deprecated int distance_sd_cm;
    field public deprecated int distance_spread_cm;
    field public int frameNumberPerBurstPeer;
    field public int measurementFrameNumber;
    field public int measurementType;
    field public int negotiatedBurstNum;
    field public deprecated int requestType;
    field public int retryAfterDuration;
    field public int rssi;
    field public int rssiSpread;
    field public deprecated int rssi_spread;
    field public long rtt;
    field public long rttSpread;
    field public long rttStandardDeviation;
    field public deprecated long rtt_ns;
    field public deprecated long rtt_sd_ns;
    field public deprecated long rtt_spread_ns;
    field public int rxRate;
    field public boolean secure;
    field public int status;
    field public int successMeasurementFrameNumber;
    field public long ts;
    field public int txRate;
    field public deprecated int tx_rate;
  }

  public static deprecated class RttManager.WifiInformationElement {
    ctor public RttManager.WifiInformationElement();
    field public byte[] data;
    field public byte id;
  }

  public class WifiConfiguration implements android.os.Parcelable {
    method public boolean hasNoInternetAccess();
    method public boolean isEphemeral();
    method public boolean isNoInternetAccessExpected();
    field public java.lang.String creatorName;
    field public int creatorUid;
    field public java.lang.String lastUpdateName;
    field public int lastUpdateUid;
    field public boolean meteredHint;
    field public int numAssociation;
    field public int numScorerOverride;
    field public int numScorerOverrideAndSwitchedNetwork;
    field public boolean useExternalScores;
  }

  public static class WifiConfiguration.KeyMgmt {
    field public static final int WPA2_PSK = 4; // 0x4
  }

  public class WifiManager {
    method public void connect(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
    method public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
    method public android.net.wifi.WifiConfiguration getWifiApConfiguration();
    method public int getWifiApState();
    method public boolean isDeviceToApRttSupported();
    method public boolean isDeviceToDeviceRttSupported();
    method public boolean isPortableHotspotSupported();
    method public boolean isWifiApEnabled();
    method public boolean isWifiScannerSupported();
    method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
    method public boolean startScan(android.os.WorkSource);
    field public static final int CHANGE_REASON_ADDED = 0; // 0x0
    field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
    field public static final int CHANGE_REASON_REMOVED = 1; // 0x1
    field public static final java.lang.String CONFIGURED_NETWORKS_CHANGED_ACTION = "android.net.wifi.CONFIGURED_NETWORKS_CHANGE";
    field public static final java.lang.String EXTRA_CHANGE_REASON = "changeReason";
    field public static final java.lang.String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
    field public static final java.lang.String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
    field public static final java.lang.String EXTRA_WIFI_AP_STATE = "wifi_state";
    field public static final java.lang.String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration";
    field public static final java.lang.String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
    field public static final java.lang.String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
    field public static final java.lang.String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED";
    field public static final int WIFI_AP_STATE_DISABLED = 11; // 0xb
    field public static final int WIFI_AP_STATE_DISABLING = 10; // 0xa
    field public static final int WIFI_AP_STATE_ENABLED = 13; // 0xd
    field public static final int WIFI_AP_STATE_ENABLING = 12; // 0xc
    field public static final int WIFI_AP_STATE_FAILED = 14; // 0xe
    field public static final java.lang.String WIFI_CREDENTIAL_CHANGED_ACTION = "android.net.wifi.WIFI_CREDENTIAL_CHANGED";
    field public static final int WIFI_CREDENTIAL_FORGOT = 1; // 0x1
    field public static final int WIFI_CREDENTIAL_SAVED = 0; // 0x0
  }

  public static abstract interface WifiManager.ActionListener {
    method public abstract void onFailure(int);
    method public abstract void onSuccess();
  }

  public class WifiNetworkConnectionStatistics implements android.os.Parcelable {
    ctor public WifiNetworkConnectionStatistics(int, int);
    ctor public WifiNetworkConnectionStatistics();
    ctor public WifiNetworkConnectionStatistics(android.net.wifi.WifiNetworkConnectionStatistics);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkConnectionStatistics> CREATOR;
    field public int numConnection;
    field public int numUsage;
  }

  public class WifiScanner {
    method public deprecated void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
    method public deprecated void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
    method public boolean getScanResults();
    method public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener);
    method public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener, android.os.WorkSource);
    method public void startScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener);
    method public void startScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener, android.os.WorkSource);
    method public deprecated void startTrackingBssids(android.net.wifi.WifiScanner.BssidInfo[], int, android.net.wifi.WifiScanner.BssidListener);
    method public deprecated void startTrackingWifiChange(android.net.wifi.WifiScanner.WifiChangeListener);
    method public void stopBackgroundScan(android.net.wifi.WifiScanner.ScanListener);
    method public void stopScan(android.net.wifi.WifiScanner.ScanListener);
    method public deprecated void stopTrackingBssids(android.net.wifi.WifiScanner.BssidListener);
    method public deprecated void stopTrackingWifiChange(android.net.wifi.WifiScanner.WifiChangeListener);
    field public static final int MAX_SCAN_PERIOD_MS = 1024000; // 0xfa000
    field public static final int MIN_SCAN_PERIOD_MS = 1000; // 0x3e8
    field public static final int REASON_DUPLICATE_REQEUST = -5; // 0xfffffffb
    field public static final int REASON_INVALID_LISTENER = -2; // 0xfffffffe
    field public static final int REASON_INVALID_REQUEST = -3; // 0xfffffffd
    field public static final int REASON_NOT_AUTHORIZED = -4; // 0xfffffffc
    field public static final int REASON_SUCCEEDED = 0; // 0x0
    field public static final int REASON_UNSPECIFIED = -1; // 0xffffffff
    field public static final deprecated int REPORT_EVENT_AFTER_BUFFER_FULL = 0; // 0x0
    field public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; // 0x1
    field public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; // 0x2
    field public static final int REPORT_EVENT_NO_BATCH = 4; // 0x4
    field public static final int WIFI_BAND_24_GHZ = 1; // 0x1
    field public static final int WIFI_BAND_5_GHZ = 2; // 0x2
    field public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; // 0x4
    field public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6; // 0x6
    field public static final int WIFI_BAND_BOTH = 3; // 0x3
    field public static final int WIFI_BAND_BOTH_WITH_DFS = 7; // 0x7
    field public static final int WIFI_BAND_UNSPECIFIED = 0; // 0x0
  }

  public static abstract interface WifiScanner.ActionListener {
    method public abstract void onFailure(int, java.lang.String);
    method public abstract void onSuccess();
  }

  public static deprecated class WifiScanner.BssidInfo {
    ctor public WifiScanner.BssidInfo();
    field public java.lang.String bssid;
    field public int frequencyHint;
    field public int high;
    field public int low;
  }

  public static abstract deprecated interface WifiScanner.BssidListener implements android.net.wifi.WifiScanner.ActionListener {
    method public abstract void onFound(android.net.wifi.ScanResult[]);
    method public abstract void onLost(android.net.wifi.ScanResult[]);
  }

  public static class WifiScanner.ChannelSpec {
    ctor public WifiScanner.ChannelSpec(int);
    field public int frequency;
  }

  public static deprecated class WifiScanner.HotlistSettings implements android.os.Parcelable {
    ctor public WifiScanner.HotlistSettings();
    field public int apLostThreshold;
    field public android.net.wifi.WifiScanner.BssidInfo[] bssidInfos;
  }

  public static class WifiScanner.ParcelableScanData implements android.os.Parcelable {
    ctor public WifiScanner.ParcelableScanData(android.net.wifi.WifiScanner.ScanData[]);
    method public android.net.wifi.WifiScanner.ScanData[] getResults();
    field public android.net.wifi.WifiScanner.ScanData[] mResults;
  }

  public static class WifiScanner.ParcelableScanResults implements android.os.Parcelable {
    ctor public WifiScanner.ParcelableScanResults(android.net.wifi.ScanResult[]);
    method public android.net.wifi.ScanResult[] getResults();
    field public android.net.wifi.ScanResult[] mResults;
  }

  public static class WifiScanner.ScanData implements android.os.Parcelable {
    ctor public WifiScanner.ScanData(int, int, android.net.wifi.ScanResult[]);
    ctor public WifiScanner.ScanData(android.net.wifi.WifiScanner.ScanData);
    method public int getFlags();
    method public int getId();
    method public android.net.wifi.ScanResult[] getResults();
  }

  public static abstract interface WifiScanner.ScanListener implements android.net.wifi.WifiScanner.ActionListener {
    method public abstract void onFullResult(android.net.wifi.ScanResult);
    method public abstract void onPeriodChanged(int);
    method public abstract void onResults(android.net.wifi.WifiScanner.ScanData[]);
  }

  public static class WifiScanner.ScanSettings implements android.os.Parcelable {
    ctor public WifiScanner.ScanSettings();
    field public int band;
    field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
    field public int maxPeriodInMs;
    field public int maxScansToCache;
    field public int numBssidsPerScan;
    field public int periodInMs;
    field public int reportEvents;
    field public int stepCount;
  }

  public static abstract deprecated interface WifiScanner.WifiChangeListener implements android.net.wifi.WifiScanner.ActionListener {
    method public abstract void onChanging(android.net.wifi.ScanResult[]);
    method public abstract void onQuiescence(android.net.wifi.ScanResult[]);
  }

  public static deprecated class WifiScanner.WifiChangeSettings implements android.os.Parcelable {
    ctor public WifiScanner.WifiChangeSettings();
    field public android.net.wifi.WifiScanner.BssidInfo[] bssidInfos;
    field public int lostApSampleSize;
    field public int minApsBreachingThreshold;
    field public int periodInMs;
    field public int rssiSampleSize;
    field public int unchangedSampleSize;
  }

}

package android.net.wifi.aware {

  public class DiscoverySession implements java.lang.AutoCloseable {
    method public android.net.NetworkSpecifier createNetworkSpecifierPmk(android.net.wifi.aware.PeerHandle, byte[]);
  }

  public class WifiAwareSession implements java.lang.AutoCloseable {
    method public android.net.NetworkSpecifier createNetworkSpecifierPmk(int, byte[], byte[]);
  }

}

package android.net.wifi.rtt {

  public static final class RangingRequest.Builder {
    method public android.net.wifi.rtt.RangingRequest.Builder addResponder(android.net.wifi.rtt.ResponderConfig);
  }

  public final class RangingResult implements android.os.Parcelable {
    method public byte[] getLci();
    method public byte[] getLcr();
  }

  public final class ResponderConfig implements android.os.Parcelable {
    ctor public ResponderConfig(android.net.MacAddress, int, boolean, int, int, int, int, int);
    ctor public ResponderConfig(android.net.wifi.aware.PeerHandle, int, boolean, int, int, int, int, int);
    method public int describeContents();
    method public static android.net.wifi.rtt.ResponderConfig fromScanResult(android.net.wifi.ScanResult);
    method public static android.net.wifi.rtt.ResponderConfig fromWifiAwarePeerHandleWithDefaults(android.net.wifi.aware.PeerHandle);
    method public static android.net.wifi.rtt.ResponderConfig fromWifiAwarePeerMacAddressWithDefaults(android.net.MacAddress);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CHANNEL_WIDTH_160MHZ = 3; // 0x3
    field public static final int CHANNEL_WIDTH_20MHZ = 0; // 0x0
    field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
    field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
    field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
    field public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderConfig> CREATOR;
    field public static final int PREAMBLE_HT = 1; // 0x1
    field public static final int PREAMBLE_LEGACY = 0; // 0x0
    field public static final int PREAMBLE_VHT = 2; // 0x2
    field public static final int RESPONDER_AP = 0; // 0x0
    field public static final int RESPONDER_AWARE = 4; // 0x4
    field public static final int RESPONDER_P2P_CLIENT = 3; // 0x3
    field public static final int RESPONDER_P2P_GO = 2; // 0x2
    field public static final int RESPONDER_STA = 1; // 0x1
    field public final int centerFreq0;
    field public final int centerFreq1;
    field public final int channelWidth;
    field public final int frequency;
    field public final android.net.MacAddress macAddress;
    field public final android.net.wifi.aware.PeerHandle peerHandle;
    field public final int preamble;
    field public final int responderType;
    field public final boolean supports80211mc;
  }

  public class WifiRttManager {
    method public void cancelRanging(android.os.WorkSource);
    method public void startRanging(android.os.WorkSource, android.net.wifi.rtt.RangingRequest, java.util.concurrent.Executor, android.net.wifi.rtt.RangingResultCallback);
  }

}

package android.nfc {

  public final class NfcAdapter {
    method public boolean addNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler, java.lang.String[]);
    method public boolean disable();
    method public boolean disable(boolean);
    method public boolean disableNdefPush();
    method public boolean enable();
    method public boolean enableNdefPush();
    method public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler);
    method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int);
    field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
  }

  public static abstract interface NfcAdapter.NfcUnlockHandler {
    method public abstract boolean onUnlockAttempted(android.nfc.Tag);
  }

}

package android.os {

  public class BatteryManager {
    field public static final java.lang.String EXTRA_EVENTS = "android.os.extra.EVENTS";
    field public static final java.lang.String EXTRA_EVENT_TIMESTAMP = "android.os.extra.EVENT_TIMESTAMP";
  }

  public final class ConfigUpdate {
    field public static final java.lang.String ACTION_UPDATE_CARRIER_ID_DB = "android.os.action.UPDATE_CARRIER_ID_DB";
    field public static final java.lang.String ACTION_UPDATE_CARRIER_PROVISIONING_URLS = "android.intent.action.UPDATE_CARRIER_PROVISIONING_URLS";
    field public static final java.lang.String ACTION_UPDATE_CT_LOGS = "android.intent.action.UPDATE_CT_LOGS";
    field public static final java.lang.String ACTION_UPDATE_INTENT_FIREWALL = "android.intent.action.UPDATE_INTENT_FIREWALL";
    field public static final java.lang.String ACTION_UPDATE_LANG_ID = "android.intent.action.UPDATE_LANG_ID";
    field public static final java.lang.String ACTION_UPDATE_NETWORK_WATCHLIST = "android.intent.action.UPDATE_NETWORK_WATCHLIST";
    field public static final java.lang.String ACTION_UPDATE_PINS = "android.intent.action.UPDATE_PINS";
    field public static final java.lang.String ACTION_UPDATE_SMART_SELECTION = "android.intent.action.UPDATE_SMART_SELECTION";
    field public static final java.lang.String ACTION_UPDATE_SMS_SHORT_CODES = "android.intent.action.UPDATE_SMS_SHORT_CODES";
  }

  public class HidlSupport {
    method public static boolean deepEquals(java.lang.Object, java.lang.Object);
    method public static int deepHashCode(java.lang.Object);
    method public static int getPidIfSharable();
    method public static boolean interfacesEqual(android.os.IHwInterface, java.lang.Object);
  }

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

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

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

  public static abstract class HwParcel.Status implements java.lang.annotation.Annotation {
  }

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

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

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

  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 userActivity(long, int, int);
    field public static final int USER_ACTIVITY_EVENT_ACCESSIBILITY = 3; // 0x3
    field public static final int USER_ACTIVITY_EVENT_BUTTON = 1; // 0x1
    field public static final int USER_ACTIVITY_EVENT_OTHER = 0; // 0x0
    field public static final int USER_ACTIVITY_EVENT_TOUCH = 2; // 0x2
    field public static final int USER_ACTIVITY_FLAG_INDIRECT = 2; // 0x2
    field public static final int USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS = 1; // 0x1
  }

  public class RecoverySystem {
    method public static void cancelScheduledUpdate(android.content.Context) throws java.io.IOException;
    method public static void installPackage(android.content.Context, java.io.File, boolean) throws java.io.IOException;
    method public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener, android.os.Handler) throws java.io.IOException;
    method public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener) throws java.io.IOException;
    method public static void rebootWipeAb(android.content.Context, java.io.File, java.lang.String) throws java.io.IOException;
    method public static void scheduleUpdateOnBoot(android.content.Context, java.io.File) throws java.io.IOException;
    method public static boolean verifyPackageCompatibility(java.io.File) throws java.io.IOException;
  }

  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 StatsDimensionsValue implements android.os.Parcelable {
    method public int describeContents();
    method public boolean getBooleanValue();
    method public int getField();
    method public float getFloatValue();
    method public int getIntValue();
    method public long getLongValue();
    method public java.lang.String getStringValue();
    method public java.util.List<android.os.StatsDimensionsValue> getTupleValueList();
    method public int getValueType();
    method public boolean isValueType(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int BOOLEAN_VALUE_TYPE = 5; // 0x5
    field public static final android.os.Parcelable.Creator<android.os.StatsDimensionsValue> CREATOR;
    field public static final int FLOAT_VALUE_TYPE = 6; // 0x6
    field public static final int INT_VALUE_TYPE = 3; // 0x3
    field public static final int LONG_VALUE_TYPE = 4; // 0x4
    field public static final int STRING_VALUE_TYPE = 2; // 0x2
    field public static final int TUPLE_VALUE_TYPE = 7; // 0x7
  }

  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);
    method public static boolean getBoolean(java.lang.String, boolean);
    method public static int getInt(java.lang.String, int);
    method public static long getLong(java.lang.String, long);
  }

  public class SystemUpdateManager {
    method public android.os.Bundle retrieveSystemUpdateInfo();
    method public void updateSystemUpdateInfo(android.os.PersistableBundle);
    field public static final java.lang.String KEY_IS_SECURITY_UPDATE = "is_security_update";
    field public static final java.lang.String KEY_STATUS = "status";
    field public static final java.lang.String KEY_TARGET_BUILD_FINGERPRINT = "target_build_fingerprint";
    field public static final java.lang.String KEY_TARGET_SECURITY_PATCH_LEVEL = "target_security_patch_level";
    field public static final java.lang.String KEY_TITLE = "title";
    field public static final int STATUS_IDLE = 1; // 0x1
    field public static final int STATUS_IN_PROGRESS = 3; // 0x3
    field public static final int STATUS_UNKNOWN = 0; // 0x0
    field public static final int STATUS_WAITING_DOWNLOAD = 2; // 0x2
    field public static final int STATUS_WAITING_INSTALL = 4; // 0x4
    field public static final int STATUS_WAITING_REBOOT = 5; // 0x5
  }

  public class UpdateEngine {
    ctor public UpdateEngine();
    method public void applyPayload(java.lang.String, long, long, java.lang.String[]);
    method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler);
    method public boolean bind(android.os.UpdateEngineCallback);
    method public void cancel();
    method public void resetStatus();
    method public void resume();
    method public void suspend();
    method public boolean unbind();
    method public boolean verifyPayloadMetadata(java.lang.String);
  }

  public static final class UpdateEngine.ErrorCodeConstants {
    ctor public UpdateEngine.ErrorCodeConstants();
    field public static final int DOWNLOAD_PAYLOAD_VERIFICATION_ERROR = 12; // 0xc
    field public static final int DOWNLOAD_TRANSFER_ERROR = 9; // 0x9
    field public static final int ERROR = 1; // 0x1
    field public static final int FILESYSTEM_COPIER_ERROR = 4; // 0x4
    field public static final int INSTALL_DEVICE_OPEN_ERROR = 7; // 0x7
    field public static final int KERNEL_DEVICE_OPEN_ERROR = 8; // 0x8
    field public static final int PAYLOAD_HASH_MISMATCH_ERROR = 10; // 0xa
    field public static final int PAYLOAD_MISMATCHED_TYPE_ERROR = 6; // 0x6
    field public static final int PAYLOAD_SIZE_MISMATCH_ERROR = 11; // 0xb
    field public static final int POST_INSTALL_RUNNER_ERROR = 5; // 0x5
    field public static final int SUCCESS = 0; // 0x0
    field public static final int UPDATED_BUT_NOT_ACTIVE = 52; // 0x34
  }

  public static final class UpdateEngine.UpdateStatusConstants {
    ctor public UpdateEngine.UpdateStatusConstants();
    field public static final int ATTEMPTING_ROLLBACK = 8; // 0x8
    field public static final int CHECKING_FOR_UPDATE = 1; // 0x1
    field public static final int DISABLED = 9; // 0x9
    field public static final int DOWNLOADING = 3; // 0x3
    field public static final int FINALIZING = 5; // 0x5
    field public static final int IDLE = 0; // 0x0
    field public static final int REPORTING_ERROR_EVENT = 7; // 0x7
    field public static final int UPDATED_NEED_REBOOT = 6; // 0x6
    field public static final int UPDATE_AVAILABLE = 2; // 0x2
    field public static final int VERIFYING = 4; // 0x4
  }

  public abstract class UpdateEngineCallback {
    ctor public UpdateEngineCallback();
    method public abstract void onPayloadApplicationComplete(int);
    method public abstract void onStatusUpdate(int, float);
  }

  public final class UserHandle implements android.os.Parcelable {
    method public int getIdentifier();
    method public deprecated boolean isOwner();
    method public boolean isSystem();
    method public static int myUserId();
    method public static android.os.UserHandle of(int);
  }

  public class UserManager {
    method public void clearSeedAccountData();
    method public java.lang.String getSeedAccountName();
    method public android.os.PersistableBundle getSeedAccountOptions();
    method public java.lang.String getSeedAccountType();
    method public long[] getSerialNumbersOfUsers(boolean);
    method public deprecated int getUserRestrictionSource(java.lang.String, android.os.UserHandle);
    method public java.util.List<android.os.UserManager.EnforcingUser> getUserRestrictionSources(java.lang.String, android.os.UserHandle);
    method public boolean hasRestrictedProfiles();
    method public boolean isManagedProfile();
    method public boolean isManagedProfile(int);
    method public boolean isRestrictedProfile();
    field public static final java.lang.String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
    field public static final deprecated java.lang.String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
    field public static final java.lang.String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
    field public static final int RESTRICTION_NOT_SET = 0; // 0x0
    field public static final int RESTRICTION_SOURCE_DEVICE_OWNER = 2; // 0x2
    field public static final int RESTRICTION_SOURCE_PROFILE_OWNER = 4; // 0x4
    field public static final int RESTRICTION_SOURCE_SYSTEM = 1; // 0x1
  }

  public static final class UserManager.EnforcingUser implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.UserHandle getUserHandle();
    method public int getUserRestrictionSource();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.os.UserManager.EnforcingUser> CREATOR;
  }

  public static abstract class UserManager.UserRestrictionSource implements java.lang.annotation.Annotation {
  }

  public class WorkSource implements android.os.Parcelable {
    method public android.os.WorkSource.WorkChain createWorkChain();
  }

  public static final class WorkSource.WorkChain implements android.os.Parcelable {
    ctor public WorkSource.WorkChain();
    method public android.os.WorkSource.WorkChain addNode(int, java.lang.String);
    method public int describeContents();
    method public java.lang.String getAttributionTag();
    method public int getAttributionUid();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.os.WorkSource.WorkChain> CREATOR;
  }

}

package android.os.storage {

  public class StorageManager {
    method public void allocateBytes(java.util.UUID, long, int) throws java.io.IOException;
    method public void allocateBytes(java.io.FileDescriptor, long, int) throws java.io.IOException;
    method public long getAllocatableBytes(java.util.UUID, int) throws java.io.IOException;
    field public static final int FLAG_ALLOCATE_AGGRESSIVE = 1; // 0x1
  }

}

package android.permissionpresenterservice {

  public abstract class RuntimePermissionPresenterService extends android.app.Service {
    ctor public RuntimePermissionPresenterService();
    method public final void attachBaseContext(android.content.Context);
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract java.util.List<android.content.pm.permission.RuntimePermissionPresentationInfo> onGetAppPermissions(java.lang.String);
    field public static final java.lang.String SERVICE_INTERFACE = "android.permissionpresenterservice.RuntimePermissionPresenterService";
  }

}

package android.preference {

  public class PreferenceManager {
    method public boolean isStorageCredentialProtected();
    method public void setStorageCredentialProtected();
  }

}

package android.print {

  public final class PrintManager {
    method public void addPrintServiceRecommendationsChangeListener(android.print.PrintManager.PrintServiceRecommendationsChangeListener, android.os.Handler);
    method public void addPrintServicesChangeListener(android.print.PrintManager.PrintServicesChangeListener, android.os.Handler);
    method public java.util.List<android.printservice.recommendation.RecommendationInfo> getPrintServiceRecommendations();
    method public java.util.List<android.printservice.PrintServiceInfo> getPrintServices(int);
    method public void removePrintServiceRecommendationsChangeListener(android.print.PrintManager.PrintServiceRecommendationsChangeListener);
    method public void removePrintServicesChangeListener(android.print.PrintManager.PrintServicesChangeListener);
    field public static final int ENABLED_SERVICES = 1; // 0x1
  }

  public static abstract interface PrintManager.PrintServiceRecommendationsChangeListener {
    method public abstract void onPrintServiceRecommendationsChanged();
  }

  public static abstract interface PrintManager.PrintServicesChangeListener {
    method public abstract void onPrintServicesChanged();
  }

}

package android.printservice {

  public final class PrintServiceInfo implements android.os.Parcelable {
    method public int describeContents();
    method public android.content.ComponentName getComponentName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.printservice.PrintServiceInfo> CREATOR;
  }

}

package android.printservice.recommendation {

  public final class RecommendationInfo implements android.os.Parcelable {
    ctor public RecommendationInfo(java.lang.CharSequence, java.lang.CharSequence, java.util.List<java.net.InetAddress>, boolean);
    ctor public deprecated RecommendationInfo(java.lang.CharSequence, java.lang.CharSequence, int, boolean);
    method public int describeContents();
    method public java.util.List<java.net.InetAddress> getDiscoveredPrinters();
    method public java.lang.CharSequence getName();
    method public int getNumDiscoveredPrinters();
    method public java.lang.CharSequence getPackageName();
    method public boolean recommendsMultiVendorService();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.printservice.recommendation.RecommendationInfo> CREATOR;
  }

  public abstract class RecommendationService extends android.app.Service {
    ctor public RecommendationService();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract void onConnected();
    method public abstract void onDisconnected();
    method public final void updateRecommendations(java.util.List<android.printservice.recommendation.RecommendationInfo>);
    field public static final java.lang.String SERVICE_INTERFACE = "android.printservice.recommendation.RecommendationService";
  }

}

package android.provider {

  public static final class ContactsContract.MetadataSync implements android.provider.BaseColumns android.provider.ContactsContract.MetadataSyncColumns {
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_metadata";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_metadata";
    field public static final android.net.Uri CONTENT_URI;
    field public static final java.lang.String METADATA_AUTHORITY = "com.android.contacts.metadata";
    field public static final android.net.Uri METADATA_AUTHORITY_URI;
  }

  protected static abstract interface ContactsContract.MetadataSyncColumns {
    field public static final java.lang.String ACCOUNT_NAME = "account_name";
    field public static final java.lang.String ACCOUNT_TYPE = "account_type";
    field public static final java.lang.String DATA = "data";
    field public static final java.lang.String DATA_SET = "data_set";
    field public static final java.lang.String DELETED = "deleted";
    field public static final java.lang.String RAW_CONTACT_BACKUP_ID = "raw_contact_backup_id";
  }

  public static final class ContactsContract.MetadataSyncState implements android.provider.BaseColumns android.provider.ContactsContract.MetadataSyncStateColumns {
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_metadata_sync_state";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_metadata_sync_state";
    field public static final android.net.Uri CONTENT_URI;
  }

  protected static abstract interface ContactsContract.MetadataSyncStateColumns {
    field public static final java.lang.String ACCOUNT_NAME = "account_name";
    field public static final java.lang.String ACCOUNT_TYPE = "account_type";
    field public static final java.lang.String DATA_SET = "data_set";
    field public static final java.lang.String STATE = "state";
  }

  public abstract class SearchIndexableData {
    ctor public SearchIndexableData();
    ctor public SearchIndexableData(android.content.Context);
    field public java.lang.String className;
    field public android.content.Context context;
    field public boolean enabled;
    field public int iconResId;
    field public java.lang.String intentAction;
    field public java.lang.String intentTargetClass;
    field public java.lang.String intentTargetPackage;
    field public java.lang.String key;
    field public java.util.Locale locale;
    field public java.lang.String packageName;
    field public int rank;
    field public int userId;
  }

  public class SearchIndexableResource extends android.provider.SearchIndexableData {
    ctor public SearchIndexableResource(int, int, java.lang.String, int);
    ctor public SearchIndexableResource(android.content.Context);
    field public int xmlResId;
  }

  public class SearchIndexablesContract {
    ctor public SearchIndexablesContract();
    field public static final int COLUMN_INDEX_NON_INDEXABLE_KEYS_KEY_VALUE = 0; // 0x0
    field public static final int COLUMN_INDEX_RAW_CLASS_NAME = 7; // 0x7
    field public static final int COLUMN_INDEX_RAW_ENTRIES = 4; // 0x4
    field public static final int COLUMN_INDEX_RAW_ICON_RESID = 8; // 0x8
    field public static final int COLUMN_INDEX_RAW_INTENT_ACTION = 9; // 0x9
    field public static final int COLUMN_INDEX_RAW_INTENT_TARGET_CLASS = 11; // 0xb
    field public static final int COLUMN_INDEX_RAW_INTENT_TARGET_PACKAGE = 10; // 0xa
    field public static final int COLUMN_INDEX_RAW_KEY = 12; // 0xc
    field public static final int COLUMN_INDEX_RAW_KEYWORDS = 5; // 0x5
    field public static final int COLUMN_INDEX_RAW_RANK = 0; // 0x0
    field public static final int COLUMN_INDEX_RAW_SCREEN_TITLE = 6; // 0x6
    field public static final int COLUMN_INDEX_RAW_SUMMARY_OFF = 3; // 0x3
    field public static final int COLUMN_INDEX_RAW_SUMMARY_ON = 2; // 0x2
    field public static final int COLUMN_INDEX_RAW_TITLE = 1; // 0x1
    field public static final int COLUMN_INDEX_RAW_USER_ID = 13; // 0xd
    field public static final int COLUMN_INDEX_XML_RES_CLASS_NAME = 2; // 0x2
    field public static final int COLUMN_INDEX_XML_RES_ICON_RESID = 3; // 0x3
    field public static final int COLUMN_INDEX_XML_RES_INTENT_ACTION = 4; // 0x4
    field public static final int COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS = 6; // 0x6
    field public static final int COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE = 5; // 0x5
    field public static final int COLUMN_INDEX_XML_RES_RANK = 0; // 0x0
    field public static final int COLUMN_INDEX_XML_RES_RESID = 1; // 0x1
    field public static final java.lang.String INDEXABLES_RAW = "indexables_raw";
    field public static final java.lang.String[] INDEXABLES_RAW_COLUMNS;
    field public static final java.lang.String INDEXABLES_RAW_PATH = "settings/indexables_raw";
    field public static final java.lang.String INDEXABLES_XML_RES = "indexables_xml_res";
    field public static final java.lang.String[] INDEXABLES_XML_RES_COLUMNS;
    field public static final java.lang.String INDEXABLES_XML_RES_PATH = "settings/indexables_xml_res";
    field public static final java.lang.String NON_INDEXABLES_KEYS = "non_indexables_key";
    field public static final java.lang.String[] NON_INDEXABLES_KEYS_COLUMNS;
    field public static final java.lang.String NON_INDEXABLES_KEYS_PATH = "settings/non_indexables_key";
    field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.SEARCH_INDEXABLES_PROVIDER";
  }

  public static class SearchIndexablesContract.BaseColumns {
    field public static final java.lang.String COLUMN_CLASS_NAME = "className";
    field public static final java.lang.String COLUMN_ICON_RESID = "iconResId";
    field public static final java.lang.String COLUMN_INTENT_ACTION = "intentAction";
    field public static final java.lang.String COLUMN_INTENT_TARGET_CLASS = "intentTargetClass";
    field public static final java.lang.String COLUMN_INTENT_TARGET_PACKAGE = "intentTargetPackage";
    field public static final java.lang.String COLUMN_RANK = "rank";
  }

  public static final class SearchIndexablesContract.NonIndexableKey extends android.provider.SearchIndexablesContract.BaseColumns {
    field public static final java.lang.String COLUMN_KEY_VALUE = "key";
    field public static final java.lang.String MIME_TYPE = "vnd.android.cursor.dir/non_indexables_key";
  }

  public static final class SearchIndexablesContract.RawData extends android.provider.SearchIndexablesContract.BaseColumns {
    field public static final java.lang.String COLUMN_ENTRIES = "entries";
    field public static final java.lang.String COLUMN_KEY = "key";
    field public static final java.lang.String COLUMN_KEYWORDS = "keywords";
    field public static final java.lang.String COLUMN_SCREEN_TITLE = "screenTitle";
    field public static final java.lang.String COLUMN_SUMMARY_OFF = "summaryOff";
    field public static final java.lang.String COLUMN_SUMMARY_ON = "summaryOn";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_USER_ID = "user_id";
    field public static final java.lang.String MIME_TYPE = "vnd.android.cursor.dir/indexables_raw";
  }

  public static final class SearchIndexablesContract.XmlResource extends android.provider.SearchIndexablesContract.BaseColumns {
    field public static final java.lang.String COLUMN_XML_RESID = "xmlResId";
    field public static final java.lang.String MIME_TYPE = "vnd.android.cursor.dir/indexables_xml_res";
  }

  public abstract class SearchIndexablesProvider extends android.content.ContentProvider {
    ctor public SearchIndexablesProvider();
    method public final int delete(android.net.Uri, java.lang.String, java.lang.String[]);
    method public java.lang.String getType(android.net.Uri);
    method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
    method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
    method public abstract android.database.Cursor queryNonIndexableKeys(java.lang.String[]);
    method public abstract android.database.Cursor queryRawData(java.lang.String[]);
    method public abstract android.database.Cursor queryXmlResources(java.lang.String[]);
    method public final int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]);
  }

  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 {
    method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String, java.lang.String, boolean);
    method public static void resetToDefaults(android.content.ContentResolver, java.lang.String);
    field public static final java.lang.String APP_STANDBY_ENABLED = "app_standby_enabled";
    field public static final java.lang.String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
    field public static final java.lang.String CARRIER_APP_NAMES = "carrier_app_names";
    field public static final java.lang.String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
    field public static final java.lang.String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
    field public static final java.lang.String EUICC_PROVISIONED = "euicc_provisioned";
    field public static final java.lang.String INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT = "install_carrier_app_notification_persistent";
    field public static final java.lang.String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS = "install_carrier_app_notification_sleep_millis";
    field public static final java.lang.String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
    field public static final java.lang.String THEATER_MODE_ON = "theater_mode_on";
    field public static final java.lang.String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
    field public static final java.lang.String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
    field public static final java.lang.String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
  }

  public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
    method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String, java.lang.String, boolean);
    method public static void resetToDefaults(android.content.ContentResolver, java.lang.String);
    field public static final java.lang.String AUTOFILL_FEATURE_FIELD_CLASSIFICATION = "autofill_field_classification";
    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 HUSH_GESTURE_USED = "hush_gesture_used";
    field public static final java.lang.String INSTANT_APPS_ENABLED = "instant_apps_enabled";
    field public static final java.lang.String MANUAL_RINGER_TOGGLE_COUNT = "manual_ringer_toggle_count";
    field public static final java.lang.String VOLUME_HUSH_GESTURE = "volume_hush_gesture";
  }

  public final class TimeZoneRulesDataContract {
    field public static final java.lang.String AUTHORITY = "com.android.timezone";
  }

  public static final class TimeZoneRulesDataContract.Operation {
    field public static final java.lang.String COLUMN_DISTRO_MAJOR_VERSION = "distro_major_version";
    field public static final java.lang.String COLUMN_DISTRO_MINOR_VERSION = "distro_minor_version";
    field public static final java.lang.String COLUMN_REVISION = "revision";
    field public static final java.lang.String COLUMN_RULES_VERSION = "rules_version";
    field public static final java.lang.String COLUMN_TYPE = "type";
    field public static final android.net.Uri CONTENT_URI;
    field public static final java.lang.String TYPE_INSTALL = "INSTALL";
    field public static final java.lang.String TYPE_NO_OP = "NOOP";
    field public static final java.lang.String TYPE_UNINSTALL = "UNINSTALL";
  }

}

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
  }

}

package android.security.keystore.recovery {

  public class DecryptionFailedException extends java.security.GeneralSecurityException {
    ctor public DecryptionFailedException(java.lang.String);
  }

  public class InternalRecoveryServiceException extends java.security.GeneralSecurityException {
    ctor public InternalRecoveryServiceException(java.lang.String);
    ctor public InternalRecoveryServiceException(java.lang.String, java.lang.Throwable);
  }

  public final class KeyChainProtectionParams implements android.os.Parcelable {
    method public void clearSecret();
    method public int describeContents();
    method public android.security.keystore.recovery.KeyDerivationParams getKeyDerivationParams();
    method public int getLockScreenUiFormat();
    method public byte[] getSecret();
    method public int getUserSecretType();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainProtectionParams> CREATOR;
    field public static final int TYPE_LOCKSCREEN = 100; // 0x64
    field public static final int UI_FORMAT_PASSWORD = 2; // 0x2
    field public static final int UI_FORMAT_PATTERN = 3; // 0x3
    field public static final int UI_FORMAT_PIN = 1; // 0x1
  }

  public static class KeyChainProtectionParams.Builder {
    ctor public KeyChainProtectionParams.Builder();
    method public android.security.keystore.recovery.KeyChainProtectionParams build();
    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setKeyDerivationParams(android.security.keystore.recovery.KeyDerivationParams);
    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setLockScreenUiFormat(int);
    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setSecret(byte[]);
    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setUserSecretType(int);
  }

  public final class KeyChainSnapshot implements android.os.Parcelable {
    method public int describeContents();
    method public long getCounterId();
    method public byte[] getEncryptedRecoveryKeyBlob();
    method public java.util.List<android.security.keystore.recovery.KeyChainProtectionParams> getKeyChainProtectionParams();
    method public int getMaxAttempts();
    method public byte[] getServerParams();
    method public int getSnapshotVersion();
    method public java.security.cert.CertPath getTrustedHardwareCertPath();
    method public java.util.List<android.security.keystore.recovery.WrappedApplicationKey> getWrappedApplicationKeys();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainSnapshot> CREATOR;
  }

  public final class KeyDerivationParams implements android.os.Parcelable {
    method public static android.security.keystore.recovery.KeyDerivationParams createScryptParams(byte[], int);
    method public static android.security.keystore.recovery.KeyDerivationParams createSha256Params(byte[]);
    method public int describeContents();
    method public int getAlgorithm();
    method public int getMemoryDifficulty();
    method public byte[] getSalt();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ALGORITHM_SCRYPT = 2; // 0x2
    field public static final int ALGORITHM_SHA256 = 1; // 0x1
    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyDerivationParams> CREATOR;
  }

  public class LockScreenRequiredException extends java.security.GeneralSecurityException {
    ctor public LockScreenRequiredException(java.lang.String);
  }

  public class RecoveryController {
    method public android.security.keystore.recovery.RecoverySession createRecoverySession();
    method public java.security.Key generateKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
    method public java.util.List<java.lang.String> getAliases() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public static android.security.keystore.recovery.RecoveryController getInstance(android.content.Context);
    method public java.security.Key getKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException, java.security.UnrecoverableKeyException;
    method public android.security.keystore.recovery.KeyChainSnapshot getKeyChainSnapshot() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int getRecoveryStatus(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public java.util.Map<java.lang.String, java.security.cert.X509Certificate> getRootCertificates();
    method public java.security.Key importKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
    method public void initRecoveryService(java.lang.String, byte[], byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
    method public static boolean isRecoverableKeyStoreEnabled(android.content.Context);
    method public void removeKey(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void setRecoverySecretTypes(int[]) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void setRecoveryStatus(java.lang.String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void setServerParams(byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void setSnapshotCreatedPendingIntent(android.app.PendingIntent) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    field public static final int RECOVERY_STATUS_PERMANENT_FAILURE = 3; // 0x3
    field public static final int RECOVERY_STATUS_SYNCED = 0; // 0x0
    field public static final int RECOVERY_STATUS_SYNC_IN_PROGRESS = 1; // 0x1
  }

  public class RecoverySession implements java.lang.AutoCloseable {
    method public void close();
    method public java.util.Map<java.lang.String, java.security.Key> recoverKeyChainSnapshot(byte[], java.util.List<android.security.keystore.recovery.WrappedApplicationKey>) throws android.security.keystore.recovery.DecryptionFailedException, android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.SessionExpiredException;
    method public byte[] start(java.lang.String, java.security.cert.CertPath, byte[], byte[], java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
  }

  public class SessionExpiredException extends java.security.GeneralSecurityException {
    ctor public SessionExpiredException(java.lang.String);
  }

  public final class WrappedApplicationKey implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.String getAlias();
    method public byte[] getEncryptedKeyMaterial();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.WrappedApplicationKey> CREATOR;
  }

  public static class WrappedApplicationKey.Builder {
    ctor public WrappedApplicationKey.Builder();
    method public android.security.keystore.recovery.WrappedApplicationKey build();
    method public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(java.lang.String);
    method public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(byte[]);
  }

}

package android.service.autofill {

  public abstract class AutofillFieldClassificationService extends android.app.Service {
    method public android.os.IBinder onBind(android.content.Intent);
    method public float[][] onGetScores(java.lang.String, android.os.Bundle, java.util.List<android.view.autofill.AutofillValue>, java.util.List<java.lang.String>);
    field public static final java.lang.String RESOURCE_AVAILABLE_ALGORITHMS = "autofill_field_classification_available_algorithms";
    field public static final java.lang.String RESOURCE_DEFAULT_ALGORITHM = "autofill_field_classification_default_algorithm";
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService";
    field public static final deprecated java.lang.String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms";
    field public static final deprecated java.lang.String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm";
  }

}

package android.service.euicc {

  public final class EuiccProfileInfo implements android.os.Parcelable {
    method public int describeContents();
    method public android.service.carrier.CarrierIdentifier getCarrierIdentifier();
    method public java.lang.String getIccid();
    method public java.lang.String getNickname();
    method public int getPolicyRules();
    method public int getProfileClass();
    method public java.lang.String getProfileName();
    method public java.lang.String getServiceProviderName();
    method public int getState();
    method public java.util.List<android.telephony.UiccAccessRule> getUiccAccessRules();
    method public boolean hasPolicyRule(int);
    method public boolean hasPolicyRules();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.euicc.EuiccProfileInfo> CREATOR;
    field public static final int POLICY_RULE_DELETE_AFTER_DISABLING = 4; // 0x4
    field public static final int POLICY_RULE_DO_NOT_DELETE = 2; // 0x2
    field public static final int POLICY_RULE_DO_NOT_DISABLE = 1; // 0x1
    field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2
    field public static final int PROFILE_CLASS_PROVISIONING = 1; // 0x1
    field public static final int PROFILE_CLASS_TESTING = 0; // 0x0
    field public static final int PROFILE_STATE_DISABLED = 0; // 0x0
    field public static final int PROFILE_STATE_ENABLED = 1; // 0x1
  }

  public static final class EuiccProfileInfo.Builder {
    ctor public EuiccProfileInfo.Builder(java.lang.String);
    ctor public EuiccProfileInfo.Builder(android.service.euicc.EuiccProfileInfo);
    method public android.service.euicc.EuiccProfileInfo build();
    method public android.service.euicc.EuiccProfileInfo.Builder setCarrierIdentifier(android.service.carrier.CarrierIdentifier);
    method public android.service.euicc.EuiccProfileInfo.Builder setIccid(java.lang.String);
    method public android.service.euicc.EuiccProfileInfo.Builder setNickname(java.lang.String);
    method public android.service.euicc.EuiccProfileInfo.Builder setPolicyRules(int);
    method public android.service.euicc.EuiccProfileInfo.Builder setProfileClass(int);
    method public android.service.euicc.EuiccProfileInfo.Builder setProfileName(java.lang.String);
    method public android.service.euicc.EuiccProfileInfo.Builder setServiceProviderName(java.lang.String);
    method public android.service.euicc.EuiccProfileInfo.Builder setState(int);
    method public android.service.euicc.EuiccProfileInfo.Builder setUiccAccessRule(java.util.List<android.telephony.UiccAccessRule>);
  }

  public static abstract class EuiccProfileInfo.PolicyRule implements java.lang.annotation.Annotation {
  }

  public static abstract class EuiccProfileInfo.ProfileClass implements java.lang.annotation.Annotation {
  }

  public static abstract class EuiccProfileInfo.ProfileState implements java.lang.annotation.Annotation {
  }

  public abstract class EuiccService extends android.app.Service {
    ctor public EuiccService();
    method public android.os.IBinder onBind(android.content.Intent);
    method public abstract int onDeleteSubscription(int, java.lang.String);
    method public abstract int onDownloadSubscription(int, android.telephony.euicc.DownloadableSubscription, boolean, boolean);
    method public abstract int onEraseSubscriptions(int);
    method public abstract android.service.euicc.GetDefaultDownloadableSubscriptionListResult onGetDefaultDownloadableSubscriptionList(int, boolean);
    method public abstract android.service.euicc.GetDownloadableSubscriptionMetadataResult onGetDownloadableSubscriptionMetadata(int, android.telephony.euicc.DownloadableSubscription, boolean);
    method public abstract java.lang.String onGetEid(int);
    method public abstract android.telephony.euicc.EuiccInfo onGetEuiccInfo(int);
    method public abstract android.service.euicc.GetEuiccProfileInfoListResult onGetEuiccProfileInfoList(int);
    method public abstract int onGetOtaStatus(int);
    method public abstract int onRetainSubscriptionsForFactoryReset(int);
    method public abstract void onStartOtaIfNecessary(int, android.service.euicc.EuiccService.OtaStatusChangedCallback);
    method public abstract int onSwitchToSubscription(int, java.lang.String, boolean);
    method public abstract int onUpdateSubscriptionNickname(int, java.lang.String, java.lang.String);
    field public static final java.lang.String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.service.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS";
    field public static final java.lang.String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.service.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION";
    field public static final java.lang.String ACTION_RESOLVE_CONFIRMATION_CODE = "android.service.euicc.action.RESOLVE_CONFIRMATION_CODE";
    field public static final java.lang.String ACTION_RESOLVE_DEACTIVATE_SIM = "android.service.euicc.action.RESOLVE_DEACTIVATE_SIM";
    field public static final java.lang.String ACTION_RESOLVE_NO_PRIVILEGES = "android.service.euicc.action.RESOLVE_NO_PRIVILEGES";
    field public static final java.lang.String CATEGORY_EUICC_UI = "android.service.euicc.category.EUICC_UI";
    field public static final java.lang.String EUICC_SERVICE_INTERFACE = "android.service.euicc.EuiccService";
    field public static final java.lang.String EXTRA_RESOLUTION_CALLING_PACKAGE = "android.service.euicc.extra.RESOLUTION_CALLING_PACKAGE";
    field public static final java.lang.String EXTRA_RESOLUTION_CONFIRMATION_CODE = "android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE";
    field public static final java.lang.String EXTRA_RESOLUTION_CONFIRMATION_CODE_RETRIED = "android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE_RETRIED";
    field public static final java.lang.String EXTRA_RESOLUTION_CONSENT = "android.service.euicc.extra.RESOLUTION_CONSENT";
    field public static final int RESULT_FIRST_USER = 1; // 0x1
    field public static final int RESULT_MUST_DEACTIVATE_SIM = -1; // 0xffffffff
    field public static final int RESULT_NEED_CONFIRMATION_CODE = -2; // 0xfffffffe
    field public static final int RESULT_OK = 0; // 0x0
  }

  public static abstract class EuiccService.OtaStatusChangedCallback {
    ctor public EuiccService.OtaStatusChangedCallback();
    method public abstract void onOtaStatusChanged(int);
  }

  public final class GetDefaultDownloadableSubscriptionListResult implements android.os.Parcelable {
    ctor public GetDefaultDownloadableSubscriptionListResult(int, android.telephony.euicc.DownloadableSubscription[]);
    method public int describeContents();
    method public java.util.List<android.telephony.euicc.DownloadableSubscription> getDownloadableSubscriptions();
    method public int getResult();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.euicc.GetDefaultDownloadableSubscriptionListResult> CREATOR;
  }

  public final class GetDownloadableSubscriptionMetadataResult implements android.os.Parcelable {
    ctor public GetDownloadableSubscriptionMetadataResult(int, android.telephony.euicc.DownloadableSubscription);
    method public int describeContents();
    method public android.telephony.euicc.DownloadableSubscription getDownloadableSubscription();
    method public int getResult();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.euicc.GetDownloadableSubscriptionMetadataResult> CREATOR;
  }

  public final class GetEuiccProfileInfoListResult implements android.os.Parcelable {
    ctor public GetEuiccProfileInfoListResult(int, android.service.euicc.EuiccProfileInfo[], boolean);
    method public int describeContents();
    method public boolean getIsRemovable();
    method public java.util.List<android.service.euicc.EuiccProfileInfo> getProfiles();
    method public int getResult();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.euicc.GetEuiccProfileInfoListResult> CREATOR;
  }

}

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_IMPORTANCE = "key_importance";
    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_SMART_REPLIES = "key_smart_replies";
    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 final class Condition implements android.os.Parcelable {
    ctor public Condition(android.net.Uri, java.lang.String, java.lang.String, java.lang.String, int, int, int);
    method public android.service.notification.Condition copy();
    method public static boolean isValidId(android.net.Uri, java.lang.String);
    method public static android.net.Uri.Builder newId(android.content.Context);
    method public static java.lang.String relevanceToString(int);
    method public static java.lang.String stateToString(int);
    field public static final int FLAG_RELEVANT_ALWAYS = 2; // 0x2
    field public static final int FLAG_RELEVANT_NOW = 1; // 0x1
    field public static final java.lang.String SCHEME = "condition";
    field public static final int STATE_ERROR = 3; // 0x3
    field public static final int STATE_UNKNOWN = 2; // 0x2
    field public final int flags;
    field public final int icon;
    field public final java.lang.String line1;
    field public final java.lang.String line2;
  }

  public abstract class ConditionProviderService extends android.app.Service {
    method public void onRequestConditions(int);
  }

  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 void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int);
    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 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.oemlock {

  public class OemLockManager {
    method public boolean isOemUnlockAllowedByCarrier();
    method public boolean isOemUnlockAllowedByUser();
    method public void setOemUnlockAllowedByCarrier(boolean, byte[]);
    method public void setOemUnlockAllowedByUser(boolean);
  }

}

package android.service.persistentdata {

  public class PersistentDataBlockManager {
    method public int getDataBlockSize();
    method public int getFlashLockState();
    method public long getMaximumDataBlockSize();
    method public deprecated boolean getOemUnlockEnabled();
    method public byte[] read();
    method public deprecated void setOemUnlockEnabled(boolean);
    method public void wipe();
    method public int write(byte[]);
    field public static final int FLASH_LOCK_LOCKED = 1; // 0x1
    field public static final int FLASH_LOCK_UNKNOWN = -1; // 0xffffffff
    field public static final int FLASH_LOCK_UNLOCKED = 0; // 0x0
  }

  public static abstract class PersistentDataBlockManager.FlashLockState implements java.lang.annotation.Annotation {
  }

}

package android.service.quicksettings {

  public class TileService extends android.app.Service {
    method public final void setStatusIcon(android.graphics.drawable.Icon, java.lang.String);
  }

}

package android.service.resolver {

  public abstract class ResolverRankerService extends android.app.Service {
    ctor public ResolverRankerService();
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onPredictSharingProbabilities(java.util.List<android.service.resolver.ResolverTarget>);
    method public void onTrainRankingModel(java.util.List<android.service.resolver.ResolverTarget>, int);
    field public static final java.lang.String BIND_PERMISSION = "android.permission.BIND_RESOLVER_RANKER_SERVICE";
    field public static final java.lang.String HOLD_PERMISSION = "android.permission.PROVIDE_RESOLVER_RANKER_SERVICE";
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.resolver.ResolverRankerService";
  }

  public final class ResolverTarget implements android.os.Parcelable {
    ctor public ResolverTarget();
    method public int describeContents();
    method public float getChooserScore();
    method public float getLaunchScore();
    method public float getRecencyScore();
    method public float getSelectProbability();
    method public float getTimeSpentScore();
    method public void setChooserScore(float);
    method public void setLaunchScore(float);
    method public void setRecencyScore(float);
    method public void setSelectProbability(float);
    method public void setTimeSpentScore(float);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.resolver.ResolverTarget> CREATOR;
  }

}

package android.service.settings.suggestions {

  public final class Suggestion implements android.os.Parcelable {
    method public int describeContents();
    method public int getFlags();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.String getId();
    method public android.app.PendingIntent getPendingIntent();
    method public java.lang.CharSequence getSummary();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.settings.suggestions.Suggestion> CREATOR;
    field public static final int FLAG_HAS_BUTTON = 1; // 0x1
  }

  public static class Suggestion.Builder {
    ctor public Suggestion.Builder(java.lang.String);
    method public android.service.settings.suggestions.Suggestion build();
    method public android.service.settings.suggestions.Suggestion.Builder setFlags(int);
    method public android.service.settings.suggestions.Suggestion.Builder setIcon(android.graphics.drawable.Icon);
    method public android.service.settings.suggestions.Suggestion.Builder setPendingIntent(android.app.PendingIntent);
    method public android.service.settings.suggestions.Suggestion.Builder setSummary(java.lang.CharSequence);
    method public android.service.settings.suggestions.Suggestion.Builder setTitle(java.lang.CharSequence);
  }

  public abstract class SuggestionService extends android.app.Service {
    ctor public SuggestionService();
    method public android.os.IBinder onBind(android.content.Intent);
    method public abstract java.util.List<android.service.settings.suggestions.Suggestion> onGetSuggestions();
    method public abstract void onSuggestionDismissed(android.service.settings.suggestions.Suggestion);
    method public abstract void onSuggestionLaunched(android.service.settings.suggestions.Suggestion);
  }

}

package android.service.textclassifier {

  public abstract class TextClassifierService extends android.app.Service {
    ctor public TextClassifierService();
    method public final android.view.textclassifier.TextClassifier getLocalTextClassifier();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract void onClassifyText(android.view.textclassifier.TextClassificationSessionId, android.view.textclassifier.TextClassification.Request, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
    method public void onCreateTextClassificationSession(android.view.textclassifier.TextClassificationContext, android.view.textclassifier.TextClassificationSessionId);
    method public void onDestroyTextClassificationSession(android.view.textclassifier.TextClassificationSessionId);
    method public abstract void onGenerateLinks(android.view.textclassifier.TextClassificationSessionId, android.view.textclassifier.TextLinks.Request, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
    method public void onSelectionEvent(android.view.textclassifier.TextClassificationSessionId, android.view.textclassifier.SelectionEvent);
    method public abstract void onSuggestSelection(android.view.textclassifier.TextClassificationSessionId, android.view.textclassifier.TextSelection.Request, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextSelection>);
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.textclassifier.TextClassifierService";
  }

  public static abstract interface TextClassifierService.Callback<T> {
    method public abstract void onFailure(java.lang.CharSequence);
    method public abstract void onSuccess(T);
  }

}

package android.service.trust {

  public class TrustAgentService extends android.app.Service {
    ctor public TrustAgentService();
    method public final void addEscrowToken(byte[], android.os.UserHandle);
    method public final deprecated void grantTrust(java.lang.CharSequence, long, boolean);
    method public final void grantTrust(java.lang.CharSequence, long, int);
    method public final void isEscrowTokenActive(long, android.os.UserHandle);
    method public final android.os.IBinder onBind(android.content.Intent);
    method public boolean onConfigure(java.util.List<android.os.PersistableBundle>);
    method public void onDeviceLocked();
    method public void onDeviceUnlockLockout(long);
    method public void onDeviceUnlocked();
    method public void onEscrowTokenAdded(byte[], long, android.os.UserHandle);
    method public void onEscrowTokenRemoved(long, boolean);
    method public void onEscrowTokenStateReceived(long, int);
    method public void onTrustTimeout();
    method public void onUnlockAttempt(boolean);
    method public final void removeEscrowToken(long, android.os.UserHandle);
    method public final void revokeTrust();
    method public final void setManagingTrust(boolean);
    method public final void showKeyguardErrorMessage(java.lang.CharSequence);
    method public final void unlockUserWithToken(long, byte[], android.os.UserHandle);
    field public static final int FLAG_GRANT_TRUST_DISMISS_KEYGUARD = 2; // 0x2
    field public static final int FLAG_GRANT_TRUST_INITIATED_BY_USER = 1; // 0x1
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.trust.TrustAgentService";
    field public static final int TOKEN_STATE_ACTIVE = 1; // 0x1
    field public static final int TOKEN_STATE_INACTIVE = 0; // 0x0
    field public static final java.lang.String TRUST_AGENT_META_DATA = "android.service.trust.trustagent";
  }

}

package android.telecom {

  public deprecated class AudioState implements android.os.Parcelable {
    ctor public AudioState(boolean, int, int);
    ctor public AudioState(android.telecom.AudioState);
    ctor public AudioState(android.telecom.CallAudioState);
    method public static java.lang.String audioRouteToString(int);
    method public int describeContents();
    method public int getRoute();
    method public int getSupportedRouteMask();
    method public boolean isMuted();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telecom.AudioState> CREATOR;
    field public static final int ROUTE_BLUETOOTH = 2; // 0x2
    field public static final int ROUTE_EARPIECE = 1; // 0x1
    field public static final int ROUTE_SPEAKER = 8; // 0x8
    field public static final int ROUTE_WIRED_HEADSET = 4; // 0x4
    field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
  }

  public final class Call {
    method public deprecated void addListener(android.telecom.Call.Listener);
    method public deprecated void removeListener(android.telecom.Call.Listener);
    field public static final deprecated int STATE_PRE_DIAL_WAIT = 8; // 0x8
  }

  public static abstract deprecated class Call.Listener extends android.telecom.Call.Callback {
    ctor public Call.Listener();
  }

  public abstract class Conference extends android.telecom.Conferenceable {
    method public final deprecated android.telecom.AudioState getAudioState();
    method public final deprecated long getConnectTimeMillis();
    method public android.telecom.Connection getPrimaryConnection();
    method public deprecated void onAudioStateChanged(android.telecom.AudioState);
    method public final deprecated void setConnectTimeMillis(long);
  }

  public abstract class Connection extends android.telecom.Conferenceable {
    method public final deprecated android.telecom.AudioState getAudioState();
    method public deprecated void onAudioStateChanged(android.telecom.AudioState);
  }

  public abstract class InCallService extends android.app.Service {
    method public deprecated android.telecom.Phone getPhone();
    method public deprecated void onPhoneCreated(android.telecom.Phone);
    method public deprecated void onPhoneDestroyed(android.telecom.Phone);
  }

  public class ParcelableCallAnalytics implements android.os.Parcelable {
    ctor public ParcelableCallAnalytics(long, long, int, boolean, boolean, int, int, boolean, java.lang.String, boolean, java.util.List<android.telecom.ParcelableCallAnalytics.AnalyticsEvent>, java.util.List<android.telecom.ParcelableCallAnalytics.EventTiming>);
    ctor public ParcelableCallAnalytics(android.os.Parcel);
    method public java.util.List<android.telecom.ParcelableCallAnalytics.AnalyticsEvent> analyticsEvents();
    method public int describeContents();
    method public long getCallDurationMillis();
    method public int getCallTechnologies();
    method public int getCallTerminationCode();
    method public int getCallType();
    method public java.lang.String getConnectionService();
    method public java.util.List<android.telecom.ParcelableCallAnalytics.EventTiming> getEventTimings();
    method public long getStartTimeMillis();
    method public boolean isAdditionalCall();
    method public boolean isCreatedFromExistingConnection();
    method public boolean isEmergencyCall();
    method public boolean isInterrupted();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALLTYPE_INCOMING = 1; // 0x1
    field public static final int CALLTYPE_OUTGOING = 2; // 0x2
    field public static final int CALLTYPE_UNKNOWN = 0; // 0x0
    field public static final int CDMA_PHONE = 1; // 0x1
    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics> CREATOR;
    field public static final int GSM_PHONE = 2; // 0x2
    field public static final int IMS_PHONE = 4; // 0x4
    field public static final long MILLIS_IN_1_SECOND = 1000L; // 0x3e8L
    field public static final long MILLIS_IN_5_MINUTES = 300000L; // 0x493e0L
    field public static final int SIP_PHONE = 8; // 0x8
    field public static final int STILL_CONNECTED = -1; // 0xffffffff
    field public static final int THIRD_PARTY_PHONE = 16; // 0x10
  }

  public static final class ParcelableCallAnalytics.AnalyticsEvent implements android.os.Parcelable {
    ctor public ParcelableCallAnalytics.AnalyticsEvent(int, long);
    method public int describeContents();
    method public int getEventName();
    method public long getTimeSinceLastEvent();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int AUDIO_ROUTE_BT = 204; // 0xcc
    field public static final int AUDIO_ROUTE_EARPIECE = 205; // 0xcd
    field public static final int AUDIO_ROUTE_HEADSET = 206; // 0xce
    field public static final int AUDIO_ROUTE_SPEAKER = 207; // 0xcf
    field public static final int BIND_CS = 5; // 0x5
    field public static final int BLOCK_CHECK_FINISHED = 105; // 0x69
    field public static final int BLOCK_CHECK_INITIATED = 104; // 0x68
    field public static final int CONFERENCE_WITH = 300; // 0x12c
    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.AnalyticsEvent> CREATOR;
    field public static final int CS_BOUND = 6; // 0x6
    field public static final int DIRECT_TO_VM_FINISHED = 103; // 0x67
    field public static final int DIRECT_TO_VM_INITIATED = 102; // 0x66
    field public static final int FILTERING_COMPLETED = 107; // 0x6b
    field public static final int FILTERING_INITIATED = 106; // 0x6a
    field public static final int FILTERING_TIMED_OUT = 108; // 0x6c
    field public static final int MUTE = 202; // 0xca
    field public static final int REMOTELY_HELD = 402; // 0x192
    field public static final int REMOTELY_UNHELD = 403; // 0x193
    field public static final int REQUEST_ACCEPT = 7; // 0x7
    field public static final int REQUEST_HOLD = 400; // 0x190
    field public static final int REQUEST_PULL = 500; // 0x1f4
    field public static final int REQUEST_REJECT = 8; // 0x8
    field public static final int REQUEST_UNHOLD = 401; // 0x191
    field public static final int SCREENING_COMPLETED = 101; // 0x65
    field public static final int SCREENING_SENT = 100; // 0x64
    field public static final int SET_ACTIVE = 1; // 0x1
    field public static final int SET_DIALING = 4; // 0x4
    field public static final int SET_DISCONNECTED = 2; // 0x2
    field public static final int SET_HOLD = 404; // 0x194
    field public static final int SET_PARENT = 302; // 0x12e
    field public static final int SET_SELECT_PHONE_ACCOUNT = 0; // 0x0
    field public static final int SILENCE = 201; // 0xc9
    field public static final int SKIP_RINGING = 200; // 0xc8
    field public static final int SPLIT_CONFERENCE = 301; // 0x12d
    field public static final int START_CONNECTION = 3; // 0x3
    field public static final int SWAP = 405; // 0x195
    field public static final int UNMUTE = 203; // 0xcb
  }

  public static final class ParcelableCallAnalytics.EventTiming implements android.os.Parcelable {
    ctor public ParcelableCallAnalytics.EventTiming(int, long);
    method public int describeContents();
    method public int getName();
    method public long getTime();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACCEPT_TIMING = 0; // 0x0
    field public static final int BIND_CS_TIMING = 6; // 0x6
    field public static final int BLOCK_CHECK_FINISHED_TIMING = 9; // 0x9
    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.EventTiming> CREATOR;
    field public static final int DIRECT_TO_VM_FINISHED_TIMING = 8; // 0x8
    field public static final int DISCONNECT_TIMING = 2; // 0x2
    field public static final int FILTERING_COMPLETED_TIMING = 10; // 0xa
    field public static final int FILTERING_TIMED_OUT_TIMING = 11; // 0xb
    field public static final int HOLD_TIMING = 3; // 0x3
    field public static final int INVALID = 999999; // 0xf423f
    field public static final int OUTGOING_TIME_TO_DIALING_TIMING = 5; // 0x5
    field public static final int REJECT_TIMING = 1; // 0x1
    field public static final int SCREENING_COMPLETED_TIMING = 7; // 0x7
    field public static final int UNHOLD_TIMING = 4; // 0x4
  }

  public final deprecated class Phone {
    method public void addListener(android.telecom.Phone.Listener);
    method public boolean canAddCall();
    method public deprecated android.telecom.AudioState getAudioState();
    method public android.telecom.CallAudioState getCallAudioState();
    method public java.util.List<android.telecom.Call> getCalls();
    method public void removeListener(android.telecom.Phone.Listener);
    method public void requestBluetoothAudio(java.lang.String);
    method public void setAudioRoute(int);
    method public void setMuted(boolean);
  }

  public static abstract class Phone.Listener {
    ctor public Phone.Listener();
    method public deprecated void onAudioStateChanged(android.telecom.Phone, android.telecom.AudioState);
    method public void onBringToForeground(android.telecom.Phone, boolean);
    method public void onCallAdded(android.telecom.Phone, android.telecom.Call);
    method public void onCallAudioStateChanged(android.telecom.Phone, android.telecom.CallAudioState);
    method public void onCallRemoved(android.telecom.Phone, android.telecom.Call);
    method public void onCanAddCallChanged(android.telecom.Phone, boolean);
    method public void onSilenceRinger(android.telecom.Phone);
  }

  public final class PhoneAccount implements android.os.Parcelable {
    field public static final int CAPABILITY_MULTI_USER = 32; // 0x20
  }

  public final class RemoteConference {
    method public deprecated void setAudioState(android.telecom.AudioState);
  }

  public final class RemoteConnection {
    method public deprecated void setAudioState(android.telecom.AudioState);
  }

  public final class StatusHints implements android.os.Parcelable {
    ctor public deprecated StatusHints(android.content.ComponentName, java.lang.CharSequence, int, android.os.Bundle);
    method public deprecated android.graphics.drawable.Drawable getIcon(android.content.Context);
    method public deprecated int getIconResId();
    method public deprecated android.content.ComponentName getPackageName();
  }

  public final class TelecomAnalytics implements android.os.Parcelable {
    ctor public TelecomAnalytics(java.util.List<android.telecom.TelecomAnalytics.SessionTiming>, java.util.List<android.telecom.ParcelableCallAnalytics>);
    method public int describeContents();
    method public java.util.List<android.telecom.ParcelableCallAnalytics> getCallAnalytics();
    method public java.util.List<android.telecom.TelecomAnalytics.SessionTiming> getSessionTimings();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics> CREATOR;
  }

  public static final class TelecomAnalytics.SessionTiming implements android.os.Parcelable {
    ctor public TelecomAnalytics.SessionTiming(int, long);
    method public int describeContents();
    method public java.lang.Integer getKey();
    method public long getTime();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics.SessionTiming> CREATOR;
    field public static final int CSW_ADD_CONFERENCE_CALL = 108; // 0x6c
    field public static final int CSW_HANDLE_CREATE_CONNECTION_COMPLETE = 100; // 0x64
    field public static final int CSW_REMOVE_CALL = 106; // 0x6a
    field public static final int CSW_SET_ACTIVE = 101; // 0x65
    field public static final int CSW_SET_DIALING = 103; // 0x67
    field public static final int CSW_SET_DISCONNECTED = 104; // 0x68
    field public static final int CSW_SET_IS_CONFERENCED = 107; // 0x6b
    field public static final int CSW_SET_ON_HOLD = 105; // 0x69
    field public static final int CSW_SET_RINGING = 102; // 0x66
    field public static final int ICA_ANSWER_CALL = 1; // 0x1
    field public static final int ICA_CONFERENCE = 8; // 0x8
    field public static final int ICA_DISCONNECT_CALL = 3; // 0x3
    field public static final int ICA_HOLD_CALL = 4; // 0x4
    field public static final int ICA_MUTE = 6; // 0x6
    field public static final int ICA_REJECT_CALL = 2; // 0x2
    field public static final int ICA_SET_AUDIO_ROUTE = 7; // 0x7
    field public static final int ICA_UNHOLD_CALL = 5; // 0x5
  }

  public class TelecomManager {
    method public void addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
    method public deprecated void clearAccounts();
    method public void clearPhoneAccounts();
    method public android.telecom.TelecomAnalytics dumpAnalytics();
    method public void enablePhoneAccount(android.telecom.PhoneAccountHandle, boolean);
    method public boolean endCall();
    method public java.util.List<android.telecom.PhoneAccountHandle> getAllPhoneAccountHandles();
    method public java.util.List<android.telecom.PhoneAccount> getAllPhoneAccounts();
    method public int getAllPhoneAccountsCount();
    method public int getCallState();
    method public android.telecom.PhoneAccountHandle getConnectionManager();
    method public deprecated android.content.ComponentName getDefaultPhoneApp();
    method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage();
    method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(java.lang.String);
    method public boolean isRinging();
    method public boolean isTtySupported();
    field public static final java.lang.String EXTRA_CALL_BACK_INTENT = "android.telecom.extra.CALL_BACK_INTENT";
    field public static final java.lang.String EXTRA_CLEAR_MISSED_CALLS_INTENT = "android.telecom.extra.CLEAR_MISSED_CALLS_INTENT";
    field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecom.extra.CONNECTION_SERVICE";
  }

}

package android.telephony {

  public static final class AccessNetworkConstants.TransportType {
    field public static final int WLAN = 2; // 0x2
    field public static final int WWAN = 1; // 0x1
  }

  public class CarrierConfigManager {
    method public static android.os.PersistableBundle getDefaultConfig();
    method public void updateConfigForPhoneId(int, java.lang.String);
    field public static final java.lang.String KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING = "config_plans_package_override_string";
  }

  public class MbmsDownloadSession implements java.lang.AutoCloseable {
    field public static final java.lang.String MBMS_DOWNLOAD_SERVICE_ACTION = "android.telephony.action.EmbmsDownload";
  }

  public class MbmsStreamingSession implements java.lang.AutoCloseable {
    field public static final java.lang.String MBMS_STREAMING_SERVICE_ACTION = "android.telephony.action.EmbmsStreaming";
  }

  public class NetworkRegistrationState implements android.os.Parcelable {
    ctor public NetworkRegistrationState(int, int, int, int, int, boolean, int[], android.telephony.CellIdentity);
    ctor protected NetworkRegistrationState(android.os.Parcel);
    method public int describeContents();
    method public int getAccessNetworkTechnology();
    method public int[] getAvailableServices();
    method public android.telephony.CellIdentity getCellIdentity();
    method public int getDomain();
    method public int getRegState();
    method public int getRejectCause();
    method public int getTransportType();
    method public boolean isEmergencyEnabled();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR;
    field public static final int DOMAIN_CS = 1; // 0x1
    field public static final int DOMAIN_PS = 2; // 0x2
    field public static final int REG_STATE_DENIED = 3; // 0x3
    field public static final int REG_STATE_HOME = 1; // 0x1
    field public static final int REG_STATE_NOT_REG_NOT_SEARCHING = 0; // 0x0
    field public static final int REG_STATE_NOT_REG_SEARCHING = 2; // 0x2
    field public static final int REG_STATE_ROAMING = 5; // 0x5
    field public static final int REG_STATE_UNKNOWN = 4; // 0x4
    field public static final int SERVICE_TYPE_DATA = 2; // 0x2
    field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
    field public static final int SERVICE_TYPE_SMS = 3; // 0x3
    field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
    field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
  }

  public abstract class NetworkService extends android.app.Service {
    ctor public NetworkService();
    method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int);
    field public static final java.lang.String NETWORK_SERVICE_EXTRA_SLOT_ID = "android.telephony.extra.SLOT_ID";
    field public static final java.lang.String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
  }

  public class NetworkService.NetworkServiceProvider {
    ctor public NetworkService.NetworkServiceProvider(int);
    method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback);
    method public final int getSlotId();
    method public final void notifyNetworkRegistrationStateChanged();
    method protected void onDestroy();
  }

  public class NetworkServiceCallback {
    method public void onGetNetworkRegistrationStateComplete(int, android.telephony.NetworkRegistrationState);
    field public static final int RESULT_ERROR_BUSY = 3; // 0x3
    field public static final int RESULT_ERROR_FAILED = 5; // 0x5
    field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
    field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
    field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1
    field public static final int RESULT_SUCCESS = 0; // 0x0
  }

  public class ServiceState implements android.os.Parcelable {
    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
    method public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
  }

  public final class SmsManager {
    method public void sendMultipartTextMessageWithoutPersisting(java.lang.String, java.lang.String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
    method public void sendTextMessageWithoutPersisting(java.lang.String, java.lang.String, java.lang.String, android.app.PendingIntent, android.app.PendingIntent);
    field public static final int RESULT_CANCELLED = 23; // 0x17
    field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
    field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
    field public static final int RESULT_ERROR_NONE = 0; // 0x0
    field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
    field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
    field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
    field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
    field public static final int RESULT_INVALID_STATE = 12; // 0xc
    field public static final int RESULT_MODEM_ERROR = 16; // 0x10
    field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
    field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
    field public static final int RESULT_NO_MEMORY = 13; // 0xd
    field public static final int RESULT_NO_RESOURCES = 22; // 0x16
    field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
    field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
    field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
    field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
  }

  public class SubscriptionInfo implements android.os.Parcelable {
    method public java.util.List<android.telephony.UiccAccessRule> getAccessRules();
  }

  public class SubscriptionManager {
    method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList();
    method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
    method public void requestEmbeddedSubscriptionInfoListRefresh();
    method public void setSubscriptionOverrideCongested(int, boolean, long);
    method public void setSubscriptionOverrideUnmetered(int, boolean, long);
    method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>);
    field public static final java.lang.String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS";
    field public static final java.lang.String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS";
  }

  public final class SubscriptionPlan implements android.os.Parcelable {
    method public java.util.Iterator<android.util.Range<java.time.ZonedDateTime>> cycleIterator();
    method public int describeContents();
    method public int getDataLimitBehavior();
    method public long getDataLimitBytes();
    method public long getDataUsageBytes();
    method public long getDataUsageTime();
    method public java.lang.CharSequence getSummary();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final long BYTES_UNKNOWN = -1L; // 0xffffffffffffffffL
    field public static final long BYTES_UNLIMITED = 9223372036854775807L; // 0x7fffffffffffffffL
    field public static final android.os.Parcelable.Creator<android.telephony.SubscriptionPlan> CREATOR;
    field public static final int LIMIT_BEHAVIOR_BILLED = 1; // 0x1
    field public static final int LIMIT_BEHAVIOR_DISABLED = 0; // 0x0
    field public static final int LIMIT_BEHAVIOR_THROTTLED = 2; // 0x2
    field public static final int LIMIT_BEHAVIOR_UNKNOWN = -1; // 0xffffffff
    field public static final long TIME_UNKNOWN = -1L; // 0xffffffffffffffffL
  }

  public static class SubscriptionPlan.Builder {
    method public android.telephony.SubscriptionPlan build();
    method public static android.telephony.SubscriptionPlan.Builder createNonrecurring(java.time.ZonedDateTime, java.time.ZonedDateTime);
    method public static android.telephony.SubscriptionPlan.Builder createRecurring(java.time.ZonedDateTime, java.time.Period);
    method public static deprecated android.telephony.SubscriptionPlan.Builder createRecurringDaily(java.time.ZonedDateTime);
    method public static deprecated android.telephony.SubscriptionPlan.Builder createRecurringMonthly(java.time.ZonedDateTime);
    method public static deprecated android.telephony.SubscriptionPlan.Builder createRecurringWeekly(java.time.ZonedDateTime);
    method public android.telephony.SubscriptionPlan.Builder setDataLimit(long, int);
    method public android.telephony.SubscriptionPlan.Builder setDataUsage(long, long);
    method public android.telephony.SubscriptionPlan.Builder setSummary(java.lang.CharSequence);
    method public android.telephony.SubscriptionPlan.Builder setTitle(java.lang.CharSequence);
  }

  public final class TelephonyHistogram implements android.os.Parcelable {
    ctor public TelephonyHistogram(int, int, int);
    ctor public TelephonyHistogram(android.telephony.TelephonyHistogram);
    ctor public TelephonyHistogram(android.os.Parcel);
    method public void addTimeTaken(int);
    method public int describeContents();
    method public int getAverageTime();
    method public int getBucketCount();
    method public int[] getBucketCounters();
    method public int[] getBucketEndPoints();
    method public int getCategory();
    method public int getId();
    method public int getMaxTime();
    method public int getMinTime();
    method public int getSampleCount();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.TelephonyHistogram> CREATOR;
    field public static final int TELEPHONY_CATEGORY_RIL = 1; // 0x1
  }

  public class TelephonyManager {
    method public deprecated void answerRingingCall();
    method public deprecated void call(java.lang.String, java.lang.String);
    method public int checkCarrierPrivilegesForPackage(java.lang.String);
    method public int checkCarrierPrivilegesForPackageAnyPhone(java.lang.String);
    method public void dial(java.lang.String);
    method public boolean disableDataConnectivity();
    method public boolean enableDataConnectivity();
    method public void enableVideoCalling(boolean);
    method public deprecated boolean endCall();
    method public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
    method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
    method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
    method public java.lang.String getCdmaMdn();
    method public java.lang.String getCdmaMdn(int);
    method public java.lang.String getCdmaMin();
    method public java.lang.String getCdmaMin(int);
    method public java.lang.String getCdmaPrlVersion();
    method public int getCurrentPhoneType();
    method public int getCurrentPhoneType(int);
    method public int getDataActivationState();
    method public deprecated boolean getDataEnabled();
    method public deprecated boolean getDataEnabled(int);
    method public boolean getEmergencyCallbackMode();
    method public int getSimApplicationState();
    method public int getSimCardState();
    method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
    method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
    method public android.os.Bundle getVisualVoicemailSettings();
    method public int getVoiceActivationState();
    method public boolean handlePinMmi(java.lang.String);
    method public boolean handlePinMmiForSubscriber(int, java.lang.String);
    method public boolean isDataConnectivityPossible();
    method public boolean isIdle();
    method public boolean isOffhook();
    method public boolean isRadioOn();
    method public boolean isRinging();
    method public boolean isVideoCallingEnabled();
    method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
    method public boolean needsOtaServiceProvisioning();
    method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
    method public void setDataActivationState(int);
    method public deprecated void setDataEnabled(int, boolean);
    method public boolean setRadio(boolean);
    method public boolean setRadioPower(boolean);
    method public void setSimPowerState(int);
    method public void setSimPowerStateForSlot(int, int);
    method public deprecated void setVisualVoicemailEnabled(android.telecom.PhoneAccountHandle, boolean);
    method public void setVoiceActivationState(int);
    method public deprecated void silenceRinger();
    method public boolean supplyPin(java.lang.String);
    method public int[] supplyPinReportResult(java.lang.String);
    method public boolean supplyPuk(java.lang.String, java.lang.String);
    method public int[] supplyPukReportResult(java.lang.String, java.lang.String);
    method public boolean switchSlots(int[]);
    method public void toggleRadioOnOff();
    method public void updateServiceLocation();
    field public static final java.lang.String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
    field public static final java.lang.String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
    field public static final java.lang.String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
    field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe
    field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1
    field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0
    field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff
    field public static final java.lang.String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
    field public static final java.lang.String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
    field public static final java.lang.String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
    field public static final int SIM_ACTIVATION_STATE_ACTIVATED = 2; // 0x2
    field public static final int SIM_ACTIVATION_STATE_ACTIVATING = 1; // 0x1
    field public static final int SIM_ACTIVATION_STATE_DEACTIVATED = 3; // 0x3
    field public static final int SIM_ACTIVATION_STATE_RESTRICTED = 4; // 0x4
    field public static final int SIM_ACTIVATION_STATE_UNKNOWN = 0; // 0x0
    field public static final int SIM_STATE_LOADED = 10; // 0xa
    field public static final int SIM_STATE_PRESENT = 11; // 0xb
  }

  public final class UiccAccessRule implements android.os.Parcelable {
    ctor public UiccAccessRule(byte[], java.lang.String, long);
    method public int describeContents();
    method public int getCarrierPrivilegeStatus(android.content.pm.PackageInfo);
    method public int getCarrierPrivilegeStatus(android.content.pm.Signature, java.lang.String);
    method public java.lang.String getCertificateHexString();
    method public java.lang.String getPackageName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR;
  }

  public class UiccSlotInfo implements android.os.Parcelable {
    ctor public UiccSlotInfo(boolean, boolean, java.lang.String, int, int, boolean);
    method public int describeContents();
    method public java.lang.String getCardId();
    method public int getCardStateInfo();
    method public boolean getIsActive();
    method public boolean getIsEuicc();
    method public boolean getIsExtendedApduSupported();
    method public int getLogicalSlotIdx();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1
    field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3
    field public static final int CARD_STATE_INFO_PRESENT = 2; // 0x2
    field public static final int CARD_STATE_INFO_RESTRICTED = 4; // 0x4
    field public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR;
  }

  public abstract class VisualVoicemailService extends android.app.Service {
    method public static final void sendVisualVoicemailSms(android.content.Context, android.telecom.PhoneAccountHandle, java.lang.String, short, java.lang.String, android.app.PendingIntent);
    method public static final void setSmsFilterSettings(android.content.Context, android.telecom.PhoneAccountHandle, android.telephony.VisualVoicemailSmsFilterSettings);
  }

}

package android.telephony.data {

  public final class DataCallResponse implements android.os.Parcelable {
    ctor public DataCallResponse(int, int, int, int, java.lang.String, java.lang.String, java.util.List<android.net.LinkAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.lang.String>, int);
    ctor public DataCallResponse(android.os.Parcel);
    method public int describeContents();
    method public int getActive();
    method public java.util.List<android.net.LinkAddress> getAddresses();
    method public int getCallId();
    method public java.util.List<java.net.InetAddress> getDnses();
    method public java.util.List<java.net.InetAddress> getGateways();
    method public java.lang.String getIfname();
    method public int getMtu();
    method public java.util.List<java.lang.String> getPcscfs();
    method public int getStatus();
    method public int getSuggestedRetryTime();
    method public java.lang.String getType();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
  }

  public final class DataProfile implements android.os.Parcelable {
    ctor public DataProfile(int, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, int, int, int, int, boolean, int, java.lang.String, int, int, java.lang.String, java.lang.String, boolean);
    ctor public DataProfile(android.os.Parcel);
    method public int describeContents();
    method public java.lang.String getApn();
    method public int getAuthType();
    method public int getBearerBitmap();
    method public int getMaxConns();
    method public int getMaxConnsTime();
    method public int getMtu();
    method public java.lang.String getMvnoMatchData();
    method public java.lang.String getMvnoType();
    method public java.lang.String getPassword();
    method public int getProfileId();
    method public java.lang.String getProtocol();
    method public java.lang.String getRoamingProtocol();
    method public int getSupportedApnTypesBitmap();
    method public int getType();
    method public java.lang.String getUserName();
    method public int getWaitTime();
    method public boolean isEnabled();
    method public boolean isModemCognitive();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR;
    field public static final int TYPE_3GPP = 1; // 0x1
    field public static final int TYPE_3GPP2 = 2; // 0x2
    field public static final int TYPE_COMMON = 0; // 0x0
  }

  public abstract class DataService extends android.app.Service {
    ctor public DataService();
    method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int);
    field public static final java.lang.String DATA_SERVICE_EXTRA_SLOT_ID = "android.telephony.data.extra.SLOT_ID";
    field public static final java.lang.String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
    field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3
    field public static final int REQUEST_REASON_NORMAL = 1; // 0x1
    field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2
  }

  public class DataService.DataServiceProvider {
    ctor public DataService.DataServiceProvider(int);
    method public void deactivateDataCall(int, int, android.telephony.data.DataServiceCallback);
    method public void getDataCallList(android.telephony.data.DataServiceCallback);
    method public final int getSlotId();
    method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
    method protected void onDestroy();
    method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, android.telephony.data.DataServiceCallback);
    method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, android.telephony.data.DataServiceCallback);
    method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, android.net.LinkProperties, android.telephony.data.DataServiceCallback);
  }

  public class DataServiceCallback {
    method public void onDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
    method public void onDeactivateDataCallComplete(int);
    method public void onGetDataCallListComplete(int, java.util.List<android.telephony.data.DataCallResponse>);
    method public void onSetDataProfileComplete(int);
    method public void onSetInitialAttachApnComplete(int);
    method public void onSetupDataCallComplete(int, android.telephony.data.DataCallResponse);
    field public static final int RESULT_ERROR_BUSY = 3; // 0x3
    field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
    field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
    field public static final int RESULT_ERROR_UNSUPPORTED = 1; // 0x1
    field public static final int RESULT_SUCCESS = 0; // 0x0
  }

}

package android.telephony.euicc {

  public final class DownloadableSubscription implements android.os.Parcelable {
    method public java.util.List<android.telephony.UiccAccessRule> getAccessRules();
    method public java.lang.String getCarrierName();
  }

  public static final class DownloadableSubscription.Builder {
    ctor public DownloadableSubscription.Builder();
    ctor public DownloadableSubscription.Builder(android.telephony.euicc.DownloadableSubscription);
    method public android.telephony.euicc.DownloadableSubscription build();
    method public android.telephony.euicc.DownloadableSubscription.Builder setAccessRules(java.util.List<android.telephony.UiccAccessRule>);
    method public android.telephony.euicc.DownloadableSubscription.Builder setCarrierName(java.lang.String);
    method public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(java.lang.String);
    method public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(java.lang.String);
  }

  public class EuiccCardManager {
    method public void authenticateServer(java.lang.String, java.lang.String, byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void cancelSession(java.lang.String, byte[], int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void deleteProfile(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void disableProfile(java.lang.String, java.lang.String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void listNotifications(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>);
    method public void loadBoundProfilePackage(java.lang.String, byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void prepareDownload(java.lang.String, byte[], byte[], byte[], byte[], java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void removeNotificationFromList(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void requestAllProfiles(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo[]>);
    method public void requestDefaultSmdpAddress(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>);
    method public void requestEuiccChallenge(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void requestEuiccInfo1(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void requestEuiccInfo2(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
    method public void requestProfile(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>);
    method public void requestRulesAuthTable(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccRulesAuthTable>);
    method public void requestSmdsAddress(java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>);
    method public void resetMemory(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void retrieveNotification(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification>);
    method public void retrieveNotificationList(java.lang.String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.telephony.euicc.EuiccNotification[]>);
    method public void setDefaultSmdpAddress(java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void setNickname(java.lang.String, java.lang.String, java.lang.String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
    method public void switchToProfile(java.lang.String, java.lang.String, boolean, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>);
    field public static final int CANCEL_REASON_END_USER_REJECTED = 0; // 0x0
    field public static final int CANCEL_REASON_POSTPONED = 1; // 0x1
    field public static final int CANCEL_REASON_PPR_NOT_ALLOWED = 3; // 0x3
    field public static final int CANCEL_REASON_TIMEOUT = 2; // 0x2
    field public static final int RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES = 2; // 0x2
    field public static final int RESET_OPTION_DELETE_OPERATIONAL_PROFILES = 1; // 0x1
    field public static final int RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS = 4; // 0x4
    field public static final int RESULT_EUICC_NOT_FOUND = -2; // 0xfffffffe
    field public static final int RESULT_OK = 0; // 0x0
    field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff
  }

  public static abstract class EuiccCardManager.CancelReason implements java.lang.annotation.Annotation {
  }

  public static abstract class EuiccCardManager.ResetOption implements java.lang.annotation.Annotation {
  }

  public static abstract interface EuiccCardManager.ResultCallback<T> {
    method public abstract void onComplete(int, T);
  }

  public class EuiccManager {
    method public void continueOperation(android.content.Intent, android.os.Bundle);
    method public void eraseSubscriptions(android.app.PendingIntent);
    method public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent);
    method public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent);
    method public int getOtaStatus();
    field public static final java.lang.String ACTION_OTA_STATUS_CHANGED = "android.telephony.euicc.action.OTA_STATUS_CHANGED";
    field public static final java.lang.String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.telephony.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION";
    field public static final int EUICC_OTA_FAILED = 2; // 0x2
    field public static final int EUICC_OTA_IN_PROGRESS = 1; // 0x1
    field public static final int EUICC_OTA_NOT_NEEDED = 4; // 0x4
    field public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; // 0x5
    field public static final int EUICC_OTA_SUCCEEDED = 3; // 0x3
    field public static final java.lang.String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS";
  }

  public static abstract class EuiccManager.OtaStatus implements java.lang.annotation.Annotation {
  }

  public final class EuiccNotification implements android.os.Parcelable {
    ctor public EuiccNotification(int, java.lang.String, int, byte[]);
    method public int describeContents();
    method public byte[] getData();
    method public int getEvent();
    method public int getSeq();
    method public java.lang.String getTargetAddr();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ALL_EVENTS = 15; // 0xf
    field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccNotification> CREATOR;
    field public static final int EVENT_DELETE = 8; // 0x8
    field public static final int EVENT_DISABLE = 4; // 0x4
    field public static final int EVENT_ENABLE = 2; // 0x2
    field public static final int EVENT_INSTALL = 1; // 0x1
  }

  public static abstract class EuiccNotification.Event implements java.lang.annotation.Annotation {
  }

  public final class EuiccRulesAuthTable implements android.os.Parcelable {
    method public int describeContents();
    method public int findIndex(int, android.service.carrier.CarrierIdentifier);
    method public boolean hasPolicyRuleFlag(int, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccRulesAuthTable> CREATOR;
    field public static final int POLICY_RULE_FLAG_CONSENT_REQUIRED = 1; // 0x1
  }

  public static final class EuiccRulesAuthTable.Builder {
    ctor public EuiccRulesAuthTable.Builder(int);
    method public android.telephony.euicc.EuiccRulesAuthTable.Builder add(int, java.util.List<android.service.carrier.CarrierIdentifier>, int);
    method public android.telephony.euicc.EuiccRulesAuthTable build();
  }

  public static abstract class EuiccRulesAuthTable.PolicyRuleFlag implements java.lang.annotation.Annotation {
  }

}

package android.telephony.ims {

  public final class ImsCallForwardInfo implements android.os.Parcelable {
    ctor public ImsCallForwardInfo(int, int, int, int, java.lang.String, int);
    method public int describeContents();
    method public int getCondition();
    method public java.lang.String getNumber();
    method public int getServiceClass();
    method public int getStatus();
    method public int getTimeSeconds();
    method public int getToA();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR;
  }

  public final class ImsCallProfile implements android.os.Parcelable {
    ctor public ImsCallProfile();
    ctor public ImsCallProfile(int, int);
    ctor public ImsCallProfile(int, int, android.os.Bundle, android.telephony.ims.ImsStreamMediaProfile);
    method public int describeContents();
    method public java.lang.String getCallExtra(java.lang.String);
    method public java.lang.String getCallExtra(java.lang.String, java.lang.String);
    method public boolean getCallExtraBoolean(java.lang.String);
    method public boolean getCallExtraBoolean(java.lang.String, boolean);
    method public int getCallExtraInt(java.lang.String);
    method public int getCallExtraInt(java.lang.String, int);
    method public android.os.Bundle getCallExtras();
    method public int getCallType();
    method public static int getCallTypeFromVideoState(int);
    method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
    method public int getRestrictCause();
    method public int getServiceType();
    method public static int getVideoStateFromCallType(int);
    method public static int getVideoStateFromImsCallProfile(android.telephony.ims.ImsCallProfile);
    method public boolean isVideoCall();
    method public boolean isVideoPaused();
    method public static int presentationToOir(int);
    method public void setCallExtra(java.lang.String, java.lang.String);
    method public void setCallExtraBoolean(java.lang.String, boolean);
    method public void setCallExtraInt(java.lang.String, int);
    method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
    method public void updateCallType(android.telephony.ims.ImsCallProfile);
    method public void updateMediaProfile(android.telephony.ims.ImsCallProfile);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; // 0x2
    field public static final int CALL_RESTRICT_CAUSE_HD = 3; // 0x3
    field public static final int CALL_RESTRICT_CAUSE_NONE = 0; // 0x0
    field public static final int CALL_RESTRICT_CAUSE_RAT = 1; // 0x1
    field public static final int CALL_TYPE_VIDEO_N_VOICE = 3; // 0x3
    field public static final int CALL_TYPE_VOICE = 2; // 0x2
    field public static final int CALL_TYPE_VOICE_N_VIDEO = 1; // 0x1
    field public static final int CALL_TYPE_VS = 8; // 0x8
    field public static final int CALL_TYPE_VS_RX = 10; // 0xa
    field public static final int CALL_TYPE_VS_TX = 9; // 0x9
    field public static final int CALL_TYPE_VT = 4; // 0x4
    field public static final int CALL_TYPE_VT_NODIR = 7; // 0x7
    field public static final int CALL_TYPE_VT_RX = 6; // 0x6
    field public static final int CALL_TYPE_VT_TX = 5; // 0x5
    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallProfile> CREATOR;
    field public static final int DIALSTRING_NORMAL = 0; // 0x0
    field public static final int DIALSTRING_SS_CONF = 1; // 0x1
    field public static final int DIALSTRING_USSD = 2; // 0x2
    field public static final java.lang.String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo";
    field public static final java.lang.String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
    field public static final java.lang.String EXTRA_CHILD_NUMBER = "ChildNum";
    field public static final java.lang.String EXTRA_CNA = "cna";
    field public static final java.lang.String EXTRA_CNAP = "cnap";
    field public static final java.lang.String EXTRA_CODEC = "Codec";
    field public static final java.lang.String EXTRA_DIALSTRING = "dialstring";
    field public static final java.lang.String EXTRA_DISPLAY_TEXT = "DisplayText";
    field public static final java.lang.String EXTRA_IS_CALL_PULL = "CallPull";
    field public static final java.lang.String EXTRA_OI = "oi";
    field public static final java.lang.String EXTRA_OIR = "oir";
    field public static final java.lang.String EXTRA_REMOTE_URI = "remote_uri";
    field public static final java.lang.String EXTRA_USSD = "ussd";
    field public static final int OIR_DEFAULT = 0; // 0x0
    field public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; // 0x2
    field public static final int OIR_PRESENTATION_PAYPHONE = 4; // 0x4
    field public static final int OIR_PRESENTATION_RESTRICTED = 1; // 0x1
    field public static final int OIR_PRESENTATION_UNKNOWN = 3; // 0x3
    field public static final int SERVICE_TYPE_EMERGENCY = 2; // 0x2
    field public static final int SERVICE_TYPE_NONE = 0; // 0x0
    field public static final int SERVICE_TYPE_NORMAL = 1; // 0x1
  }

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

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

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

  public final class ImsReasonInfo implements android.os.Parcelable {
    ctor public ImsReasonInfo(int, int, java.lang.String);
    method public int describeContents();
    method public int getCode();
    method public int getExtraCode();
    method public java.lang.String getExtraMessage();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CODE_ACCESS_CLASS_BLOCKED = 1512; // 0x5e8
    field public static final int CODE_ANSWERED_ELSEWHERE = 1014; // 0x3f6
    field public static final int CODE_BLACKLISTED_CALL_ID = 506; // 0x1fa
    field public static final int CODE_CALL_BARRED = 240; // 0xf0
    field public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100; // 0x44c
    field public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016; // 0x3f8
    field public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015; // 0x3f7
    field public static final int CODE_DATA_DISABLED = 1406; // 0x57e
    field public static final int CODE_DATA_LIMIT_REACHED = 1405; // 0x57d
    field public static final int CODE_DIAL_MODIFIED_TO_DIAL = 246; // 0xf6
    field public static final int CODE_DIAL_MODIFIED_TO_DIAL_VIDEO = 247; // 0xf7
    field public static final int CODE_DIAL_MODIFIED_TO_SS = 245; // 0xf5
    field public static final int CODE_DIAL_MODIFIED_TO_USSD = 244; // 0xf4
    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL = 248; // 0xf8
    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 249; // 0xf9
    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_SS = 250; // 0xfa
    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_USSD = 251; // 0xfb
    field public static final int CODE_ECBM_NOT_SUPPORTED = 901; // 0x385
    field public static final int CODE_EMERGENCY_PERM_FAILURE = 364; // 0x16c
    field public static final int CODE_EMERGENCY_TEMP_FAILURE = 363; // 0x16b
    field public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400; // 0x578
    field public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402; // 0x57a
    field public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401; // 0x579
    field public static final int CODE_FDN_BLOCKED = 241; // 0xf1
    field public static final int CODE_IKEV2_AUTH_FAILURE = 1408; // 0x580
    field public static final int CODE_IMEI_NOT_ACCEPTED = 243; // 0xf3
    field public static final int CODE_IWLAN_DPD_FAILURE = 1300; // 0x514
    field public static final int CODE_LOCAL_CALL_BUSY = 142; // 0x8e
    field public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146; // 0x92
    field public static final int CODE_LOCAL_CALL_DECLINE = 143; // 0x8f
    field public static final int CODE_LOCAL_CALL_EXCEEDED = 141; // 0x8d
    field public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145; // 0x91
    field public static final int CODE_LOCAL_CALL_TERMINATED = 148; // 0x94
    field public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144; // 0x90
    field public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147; // 0x93
    field public static final int CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE = 108; // 0x6c
    field public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149; // 0x95
    field public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101; // 0x65
    field public static final int CODE_LOCAL_ILLEGAL_STATE = 102; // 0x66
    field public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106; // 0x6a
    field public static final int CODE_LOCAL_INTERNAL_ERROR = 103; // 0x67
    field public static final int CODE_LOCAL_LOW_BATTERY = 112; // 0x70
    field public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124; // 0x7c
    field public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122; // 0x7a
    field public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121; // 0x79
    field public static final int CODE_LOCAL_NETWORK_ROAMING = 123; // 0x7b
    field public static final int CODE_LOCAL_NOT_REGISTERED = 132; // 0x84
    field public static final int CODE_LOCAL_NO_PENDING_CALL = 107; // 0x6b
    field public static final int CODE_LOCAL_POWER_OFF = 111; // 0x6f
    field public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131; // 0x83
    field public static final int CODE_LOW_BATTERY = 505; // 0x1f9
    field public static final int CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED = 1403; // 0x57b
    field public static final int CODE_MEDIA_INIT_FAILED = 401; // 0x191
    field public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403; // 0x193
    field public static final int CODE_MEDIA_NO_DATA = 402; // 0x192
    field public static final int CODE_MEDIA_UNSPECIFIED = 404; // 0x194
    field public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902; // 0x386
    field public static final int CODE_NETWORK_DETACH = 1513; // 0x5e9
    field public static final int CODE_NETWORK_REJECT = 1504; // 0x5e0
    field public static final int CODE_NETWORK_RESP_TIMEOUT = 1503; // 0x5df
    field public static final int CODE_NO_VALID_SIM = 1501; // 0x5dd
    field public static final int CODE_OEM_CAUSE_1 = 61441; // 0xf001
    field public static final int CODE_OEM_CAUSE_10 = 61450; // 0xf00a
    field public static final int CODE_OEM_CAUSE_11 = 61451; // 0xf00b
    field public static final int CODE_OEM_CAUSE_12 = 61452; // 0xf00c
    field public static final int CODE_OEM_CAUSE_13 = 61453; // 0xf00d
    field public static final int CODE_OEM_CAUSE_14 = 61454; // 0xf00e
    field public static final int CODE_OEM_CAUSE_15 = 61455; // 0xf00f
    field public static final int CODE_OEM_CAUSE_2 = 61442; // 0xf002
    field public static final int CODE_OEM_CAUSE_3 = 61443; // 0xf003
    field public static final int CODE_OEM_CAUSE_4 = 61444; // 0xf004
    field public static final int CODE_OEM_CAUSE_5 = 61445; // 0xf005
    field public static final int CODE_OEM_CAUSE_6 = 61446; // 0xf006
    field public static final int CODE_OEM_CAUSE_7 = 61447; // 0xf007
    field public static final int CODE_OEM_CAUSE_8 = 61448; // 0xf008
    field public static final int CODE_OEM_CAUSE_9 = 61449; // 0xf009
    field public static final int CODE_RADIO_ACCESS_FAILURE = 1505; // 0x5e1
    field public static final int CODE_RADIO_INTERNAL_ERROR = 1502; // 0x5de
    field public static final int CODE_RADIO_LINK_FAILURE = 1506; // 0x5e2
    field public static final int CODE_RADIO_LINK_LOST = 1507; // 0x5e3
    field public static final int CODE_RADIO_OFF = 1500; // 0x5dc
    field public static final int CODE_RADIO_RELEASE_ABNORMAL = 1511; // 0x5e7
    field public static final int CODE_RADIO_RELEASE_NORMAL = 1510; // 0x5e6
    field public static final int CODE_RADIO_SETUP_FAILURE = 1509; // 0x5e5
    field public static final int CODE_RADIO_UPLINK_FAILURE = 1508; // 0x5e4
    field public static final int CODE_REGISTRATION_ERROR = 1000; // 0x3e8
    field public static final int CODE_REJECT_1X_COLLISION = 1603; // 0x643
    field public static final int CODE_REJECT_CALL_ON_OTHER_SUB = 1602; // 0x642
    field public static final int CODE_REJECT_CALL_TYPE_NOT_ALLOWED = 1605; // 0x645
    field public static final int CODE_REJECT_CONFERENCE_TTY_NOT_ALLOWED = 1617; // 0x651
    field public static final int CODE_REJECT_INTERNAL_ERROR = 1612; // 0x64c
    field public static final int CODE_REJECT_MAX_CALL_LIMIT_REACHED = 1608; // 0x648
    field public static final int CODE_REJECT_ONGOING_CALL_SETUP = 1607; // 0x647
    field public static final int CODE_REJECT_ONGOING_CALL_TRANSFER = 1611; // 0x64b
    field public static final int CODE_REJECT_ONGOING_CALL_UPGRADE = 1616; // 0x650
    field public static final int CODE_REJECT_ONGOING_CALL_WAITING_DISABLED = 1601; // 0x641
    field public static final int CODE_REJECT_ONGOING_CONFERENCE_CALL = 1618; // 0x652
    field public static final int CODE_REJECT_ONGOING_CS_CALL = 1621; // 0x655
    field public static final int CODE_REJECT_ONGOING_E911_CALL = 1606; // 0x646
    field public static final int CODE_REJECT_ONGOING_ENCRYPTED_CALL = 1620; // 0x654
    field public static final int CODE_REJECT_ONGOING_HANDOVER = 1614; // 0x64e
    field public static final int CODE_REJECT_QOS_FAILURE = 1613; // 0x64d
    field public static final int CODE_REJECT_SERVICE_NOT_REGISTERED = 1604; // 0x644
    field public static final int CODE_REJECT_UNKNOWN = 1600; // 0x640
    field public static final int CODE_REJECT_UNSUPPORTED_SDP_HEADERS = 1610; // 0x64a
    field public static final int CODE_REJECT_UNSUPPORTED_SIP_HEADERS = 1609; // 0x649
    field public static final int CODE_REJECT_VT_AVPF_NOT_ALLOWED = 1619; // 0x653
    field public static final int CODE_REJECT_VT_TTY_NOT_ALLOWED = 1615; // 0x64f
    field public static final int CODE_REMOTE_CALL_DECLINE = 1404; // 0x57c
    field public static final int CODE_SIP_ALTERNATE_EMERGENCY_CALL = 1514; // 0x5ea
    field public static final int CODE_SIP_BAD_ADDRESS = 337; // 0x151
    field public static final int CODE_SIP_BAD_REQUEST = 331; // 0x14b
    field public static final int CODE_SIP_BUSY = 338; // 0x152
    field public static final int CODE_SIP_CLIENT_ERROR = 342; // 0x156
    field public static final int CODE_SIP_FORBIDDEN = 332; // 0x14c
    field public static final int CODE_SIP_GLOBAL_ERROR = 362; // 0x16a
    field public static final int CODE_SIP_NOT_ACCEPTABLE = 340; // 0x154
    field public static final int CODE_SIP_NOT_FOUND = 333; // 0x14d
    field public static final int CODE_SIP_NOT_REACHABLE = 341; // 0x155
    field public static final int CODE_SIP_NOT_SUPPORTED = 334; // 0x14e
    field public static final int CODE_SIP_REDIRECTED = 321; // 0x141
    field public static final int CODE_SIP_REQUEST_CANCELLED = 339; // 0x153
    field public static final int CODE_SIP_REQUEST_TIMEOUT = 335; // 0x14f
    field public static final int CODE_SIP_SERVER_ERROR = 354; // 0x162
    field public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351; // 0x15f
    field public static final int CODE_SIP_SERVER_TIMEOUT = 353; // 0x161
    field public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; // 0x160
    field public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; // 0x150
    field public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343; // 0x157
    field public static final int CODE_SIP_USER_REJECTED = 361; // 0x169
    field public static final int CODE_SUPP_SVC_CANCELLED = 1202; // 0x4b2
    field public static final int CODE_SUPP_SVC_FAILED = 1201; // 0x4b1
    field public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203; // 0x4b3
    field public static final int CODE_TIMEOUT_1XX_WAITING = 201; // 0xc9
    field public static final int CODE_TIMEOUT_NO_ANSWER = 202; // 0xca
    field public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203; // 0xcb
    field public static final int CODE_UNSPECIFIED = 0; // 0x0
    field public static final int CODE_USER_DECLINE = 504; // 0x1f8
    field public static final int CODE_USER_IGNORE = 503; // 0x1f7
    field public static final int CODE_USER_NOANSWER = 502; // 0x1f6
    field public static final int CODE_USER_TERMINATED = 501; // 0x1f5
    field public static final int CODE_USER_TERMINATED_BY_REMOTE = 510; // 0x1fe
    field public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821; // 0x335
    field public static final int CODE_UT_NETWORK_ERROR = 804; // 0x324
    field public static final int CODE_UT_NOT_SUPPORTED = 801; // 0x321
    field public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803; // 0x323
    field public static final int CODE_UT_SERVICE_UNAVAILABLE = 802; // 0x322
    field public static final int CODE_UT_SS_MODIFIED_TO_DIAL = 822; // 0x336
    field public static final int CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO = 825; // 0x339
    field public static final int CODE_UT_SS_MODIFIED_TO_SS = 824; // 0x338
    field public static final int CODE_UT_SS_MODIFIED_TO_USSD = 823; // 0x337
    field public static final int CODE_WIFI_LOST = 1407; // 0x57f
    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsReasonInfo> CREATOR;
    field public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3; // 0x3
    field public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1; // 0x1
    field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2
    field public static final java.lang.String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service";
  }

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

  public final class ImsSsData implements android.os.Parcelable {
    ctor public ImsSsData(int, int, int, int, int);
    method public int describeContents();
    method public boolean isTypeBarring();
    method public boolean isTypeCf();
    method public boolean isTypeClip();
    method public boolean isTypeClir();
    method public boolean isTypeColp();
    method public boolean isTypeColr();
    method public boolean isTypeCw();
    method public boolean isTypeIcb();
    method public boolean isTypeInterrogation();
    method public boolean isTypeUnConditional();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR;
    field public static final int SS_ACTIVATION = 0; // 0x0
    field public static final int SS_ALL_BARRING = 18; // 0x12
    field public static final int SS_ALL_DATA_TELESERVICES = 3; // 0x3
    field public static final int SS_ALL_TELESERVICES_EXCEPT_SMS = 5; // 0x5
    field public static final int SS_ALL_TELESEVICES = 1; // 0x1
    field public static final int SS_ALL_TELE_AND_BEARER_SERVICES = 0; // 0x0
    field public static final int SS_BAIC = 16; // 0x10
    field public static final int SS_BAIC_ROAMING = 17; // 0x11
    field public static final int SS_BAOC = 13; // 0xd
    field public static final int SS_BAOIC = 14; // 0xe
    field public static final int SS_BAOIC_EXC_HOME = 15; // 0xf
    field public static final int SS_CFU = 0; // 0x0
    field public static final int SS_CFUT = 6; // 0x6
    field public static final int SS_CF_ALL = 4; // 0x4
    field public static final int SS_CF_ALL_CONDITIONAL = 5; // 0x5
    field public static final int SS_CF_BUSY = 1; // 0x1
    field public static final int SS_CF_NOT_REACHABLE = 3; // 0x3
    field public static final int SS_CF_NO_REPLY = 2; // 0x2
    field public static final int SS_CLIP = 7; // 0x7
    field public static final int SS_CLIR = 8; // 0x8
    field public static final int SS_CNAP = 11; // 0xb
    field public static final int SS_COLP = 9; // 0x9
    field public static final int SS_COLR = 10; // 0xa
    field public static final int SS_DEACTIVATION = 1; // 0x1
    field public static final int SS_ERASURE = 4; // 0x4
    field public static final int SS_INCOMING_BARRING = 20; // 0x14
    field public static final int SS_INCOMING_BARRING_ANONYMOUS = 22; // 0x16
    field public static final int SS_INCOMING_BARRING_DN = 21; // 0x15
    field public static final int SS_INTERROGATION = 2; // 0x2
    field public static final int SS_OUTGOING_BARRING = 19; // 0x13
    field public static final int SS_REGISTRATION = 3; // 0x3
    field public static final int SS_SMS_SERVICES = 4; // 0x4
    field public static final int SS_TELEPHONY = 2; // 0x2
    field public static final int SS_WAIT = 12; // 0xc
  }

  public final class ImsSsInfo implements android.os.Parcelable {
    ctor public ImsSsInfo(int, java.lang.String);
    method public int describeContents();
    method public java.lang.String getIcbNum();
    method public int getProvisionStatus();
    method public int getStatus();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR;
    field public static final int DISABLED = 0; // 0x0
    field public static final int ENABLED = 1; // 0x1
    field public static final int NOT_REGISTERED = -1; // 0xffffffff
    field public static final int SERVICE_NOT_PROVISIONED = 0; // 0x0
    field public static final int SERVICE_PROVISIONED = 1; // 0x1
    field public static final int SERVICE_PROVISIONING_UNKNOWN = -1; // 0xffffffff
  }

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

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

  public class ImsUtListener {
    method public void onSupplementaryServiceIndication(android.telephony.ims.ImsSsData);
    method public void onUtConfigurationCallBarringQueried(int, android.telephony.ims.ImsSsInfo[]);
    method public void onUtConfigurationCallForwardQueried(int, android.telephony.ims.ImsCallForwardInfo[]);
    method public void onUtConfigurationCallWaitingQueried(int, android.telephony.ims.ImsSsInfo[]);
    method public void onUtConfigurationQueried(int, android.os.Bundle);
    method public void onUtConfigurationQueryFailed(int, android.telephony.ims.ImsReasonInfo);
    method public void onUtConfigurationUpdateFailed(int, android.telephony.ims.ImsReasonInfo);
    method public void onUtConfigurationUpdated(int);
  }

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

}

package android.telephony.ims.feature {

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

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

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

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

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

  public static class MmTelFeature.MmTelCapabilities {
    ctor public MmTelFeature.MmTelCapabilities(android.telephony.ims.feature.ImsFeature.Capabilities);
    ctor public MmTelFeature.MmTelCapabilities(int);
    method public final void addCapabilities(int);
    method public final boolean isCapable(int);
    method public final void removeCapabilities(int);
    field public static final int CAPABILITY_TYPE_SMS = 8; // 0x8
    field public static final int CAPABILITY_TYPE_UT = 4; // 0x4
    field public static final int CAPABILITY_TYPE_VIDEO = 2; // 0x2
    field public static final int CAPABILITY_TYPE_VOICE = 1; // 0x1
  }

  public static abstract class MmTelFeature.MmTelCapabilities.MmTelCapability implements java.lang.annotation.Annotation {
  }

  public static abstract class MmTelFeature.ProcessCallResult implements java.lang.annotation.Annotation {
  }

  public class RcsFeature extends android.telephony.ims.feature.ImsFeature {
    ctor public RcsFeature();
    method public void changeEnabledCapabilities(android.telephony.ims.feature.CapabilityChangeRequest, android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
    method public void onFeatureReady();
    method public void onFeatureRemoved();
  }

}

package android.telephony.ims.stub {

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

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

  public class ImsConfigImplBase {
    ctor public ImsConfigImplBase();
    method public int getConfigInt(int);
    method public java.lang.String getConfigString(int);
    method public final void notifyProvisionedValueChanged(int, int);
    method public final void notifyProvisionedValueChanged(int, java.lang.String);
    method public int setConfig(int, int);
    method public int setConfig(int, java.lang.String);
    field public static final int CONFIG_RESULT_FAILED = 1; // 0x1
    field public static final int CONFIG_RESULT_SUCCESS = 0; // 0x0
    field public static final int CONFIG_RESULT_UNKNOWN = -1; // 0xffffffff
  }

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

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

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

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

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

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

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

  public class ImsUtImplBase {
    ctor public ImsUtImplBase();
    method public void close();
    method public int queryCallBarring(int);
    method public int queryCallBarringForServiceClass(int, int);
    method public int queryCallForward(int, java.lang.String);
    method public int queryCallWaiting();
    method public int queryClip();
    method public int queryClir();
    method public int queryColp();
    method public int queryColr();
    method public void setListener(android.telephony.ims.ImsUtListener);
    method public int transact(android.os.Bundle);
    method public int updateCallBarring(int, int, java.lang.String[]);
    method public int updateCallBarringForServiceClass(int, int, java.lang.String[], int);
    method public int updateCallForward(int, int, java.lang.String, int, int);
    method public int updateCallWaiting(boolean, int);
    method public int updateClip(boolean);
    method public int updateClir(int);
    method public int updateColp(boolean);
    method public int updateColr(int);
  }

}

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 class MbmsDownloadReceiver extends android.content.BroadcastReceiver {
    field public static final int RESULT_APP_NOTIFICATION_ERROR = 6; // 0x6
    field public static final int RESULT_BAD_TEMP_FILE_ROOT = 3; // 0x3
    field public static final int RESULT_DOWNLOAD_FINALIZATION_ERROR = 4; // 0x4
    field public static final int RESULT_INVALID_ACTION = 1; // 0x1
    field public static final int RESULT_MALFORMED_INTENT = 2; // 0x2
    field public static final int RESULT_OK = 0; // 0x0
    field public static final int RESULT_TEMP_FILE_GENERATION_ERROR = 5; // 0x5
  }

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

  public class EventLog {
    method public static void readEventsOnWrapping(int[], long, java.util.Collection<android.util.EventLog.Event>) throws java.io.IOException;
  }

  public static final class EventLog.Event {
    method public int getUid();
  }

}

package android.view {

  public abstract interface WindowManager implements android.view.ViewManager {
    method public abstract android.graphics.Region getCurrentImeTouchRegion();
  }

  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
    method public final long getUserActivityTimeout();
    method public final void setUserActivityTimeout(long);
  }

}

package android.webkit {

  public abstract class CookieManager {
    method protected abstract boolean allowFileSchemeCookiesImpl();
    method public abstract java.lang.String getCookie(java.lang.String, boolean);
    method public synchronized java.lang.String getCookie(android.net.WebAddress);
    method public abstract boolean hasCookies(boolean);
    method protected abstract void setAcceptFileSchemeCookiesImpl(boolean);
  }

  public class FindActionModeCallback implements android.view.ActionMode.Callback android.text.TextWatcher android.view.View.OnClickListener android.webkit.WebView.FindListener {
    ctor public FindActionModeCallback(android.content.Context);
    method public void afterTextChanged(android.text.Editable);
    method public void beforeTextChanged(java.lang.CharSequence, int, int, int);
    method public void findAll();
    method public void finish();
    method public int getActionModeGlobalBottom();
    method public boolean onActionItemClicked(android.view.ActionMode, android.view.MenuItem);
    method public void onClick(android.view.View);
    method public boolean onCreateActionMode(android.view.ActionMode, android.view.Menu);
    method public void onDestroyActionMode(android.view.ActionMode);
    method public void onFindResultReceived(int, int, boolean);
    method public boolean onPrepareActionMode(android.view.ActionMode, android.view.Menu);
    method public void onTextChanged(java.lang.CharSequence, int, int, int);
    method public void setText(java.lang.String);
    method public void setWebView(android.webkit.WebView);
    method public void showSoftInput();
    method public void updateMatchCount(int, int, boolean);
  }

  public static class FindActionModeCallback.NoAction implements android.view.ActionMode.Callback {
    ctor public FindActionModeCallback.NoAction();
    method public boolean onActionItemClicked(android.view.ActionMode, android.view.MenuItem);
    method public boolean onCreateActionMode(android.view.ActionMode, android.view.Menu);
    method public void onDestroyActionMode(android.view.ActionMode);
    method public boolean onPrepareActionMode(android.view.ActionMode, android.view.Menu);
  }

  public class GeolocationPermissions {
    ctor public GeolocationPermissions();
  }

  public class HttpAuthHandler extends android.os.Handler {
    ctor public HttpAuthHandler();
  }

  public class JsDialogHelper {
    ctor public JsDialogHelper(android.webkit.JsPromptResult, int, java.lang.String, java.lang.String, java.lang.String);
    ctor public JsDialogHelper(android.webkit.JsPromptResult, android.os.Message);
    method public boolean invokeCallback(android.webkit.WebChromeClient, android.webkit.WebView);
    method public void showDialog(android.content.Context);
    field public static final int ALERT = 1; // 0x1
    field public static final int CONFIRM = 2; // 0x2
    field public static final int PROMPT = 3; // 0x3
    field public static final int UNLOAD = 4; // 0x4
  }

  public class JsPromptResult extends android.webkit.JsResult {
    ctor public JsPromptResult(android.webkit.JsResult.ResultReceiver);
    method public java.lang.String getStringResult();
  }

  public class JsResult {
    ctor public JsResult(android.webkit.JsResult.ResultReceiver);
    method public final boolean getResult();
  }

  public static abstract interface JsResult.ResultReceiver {
    method public abstract void onJsResultComplete(android.webkit.JsResult);
  }

  public class SslErrorHandler extends android.os.Handler {
    ctor public SslErrorHandler();
  }

  public abstract class TokenBindingService {
    ctor public TokenBindingService();
    method public abstract void deleteAllKeys(android.webkit.ValueCallback<java.lang.Boolean>);
    method public abstract void deleteKey(android.net.Uri, android.webkit.ValueCallback<java.lang.Boolean>);
    method public abstract void enableTokenBinding();
    method public static android.webkit.TokenBindingService getInstance();
    method public abstract void getKey(android.net.Uri, java.lang.String[], android.webkit.ValueCallback<android.webkit.TokenBindingService.TokenBindingKey>);
    field public static final java.lang.String KEY_ALGORITHM_ECDSAP256 = "ECDSAP256";
    field public static final java.lang.String KEY_ALGORITHM_RSA2048_PKCS_1_5 = "RSA2048_PKCS_1.5";
    field public static final java.lang.String KEY_ALGORITHM_RSA2048_PSS = "RSA2048PSS";
  }

  public static abstract class TokenBindingService.TokenBindingKey {
    ctor public TokenBindingService.TokenBindingKey();
    method public abstract java.lang.String getAlgorithm();
    method public abstract java.security.KeyPair getKeyPair();
  }

  public class WebChromeClient {
    method public deprecated void openFileChooser(android.webkit.ValueCallback<android.net.Uri>, java.lang.String, java.lang.String);
  }

  public abstract class WebHistoryItem implements java.lang.Cloneable {
    method public abstract deprecated int getId();
  }

  public abstract deprecated class WebIconDatabase {
    method public abstract void bulkRequestIconForPageUrl(android.content.ContentResolver, java.lang.String, android.webkit.WebIconDatabase.IconListener);
  }

  public abstract class WebMessagePort {
    ctor public WebMessagePort();
  }

  public abstract class WebResourceError {
    ctor public WebResourceError();
  }

  public class WebResourceResponse {
    ctor public WebResourceResponse(boolean, java.lang.String, java.lang.String, int, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, java.io.InputStream);
  }

  public abstract class WebSettings {
    method public abstract boolean getAcceptThirdPartyCookies();
    method public abstract deprecated boolean getNavDump();
    method public abstract deprecated boolean getPluginsEnabled();
    method public abstract deprecated boolean getUseWebViewBackgroundForOverscrollBackground();
    method public abstract deprecated int getUserAgent();
    method public abstract boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled();
    method public abstract void setAcceptThirdPartyCookies(boolean);
    method public abstract deprecated void setNavDump(boolean);
    method public abstract deprecated void setPluginsEnabled(boolean);
    method public abstract deprecated void setUseWebViewBackgroundForOverscrollBackground(boolean);
    method public abstract deprecated void setUserAgent(int);
    method public abstract void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean);
  }

  public class WebStorage {
    ctor public WebStorage();
  }

  public static class WebStorage.Origin {
    ctor protected WebStorage.Origin(java.lang.String, long, long);
  }

  public class WebView extends android.widget.AbsoluteLayout implements android.view.ViewGroup.OnHierarchyChangeListener android.view.ViewTreeObserver.OnGlobalFocusChangeListener {
    method public android.webkit.WebViewProvider getWebViewProvider();
  }

  public static class WebView.HitTestResult {
    ctor public WebView.HitTestResult();
    method public void setExtra(java.lang.String);
    method public void setType(int);
  }

  public class WebView.PrivateAccess {
    ctor public WebView.PrivateAccess();
    method public void awakenScrollBars(int);
    method public void awakenScrollBars(int, boolean);
    method public float getHorizontalScrollFactor();
    method public int getHorizontalScrollbarHeight();
    method public float getVerticalScrollFactor();
    method public void onScrollChanged(int, int, int, int);
    method public void overScrollBy(int, int, int, int, int, int, int, int, boolean);
    method public void setMeasuredDimension(int, int);
    method public void setScrollXRaw(int);
    method public void setScrollYRaw(int);
    method public void super_computeScroll();
    method public boolean super_dispatchKeyEvent(android.view.KeyEvent);
    method public int super_getScrollBarStyle();
    method public void super_onDrawVerticalScrollBar(android.graphics.Canvas, android.graphics.drawable.Drawable, int, int, int, int);
    method public boolean super_onGenericMotionEvent(android.view.MotionEvent);
    method public boolean super_onHoverEvent(android.view.MotionEvent);
    method public boolean super_performAccessibilityAction(int, android.os.Bundle);
    method public boolean super_performLongClick();
    method public boolean super_requestFocus(int, android.graphics.Rect);
    method public void super_scrollTo(int, int);
    method public boolean super_setFrame(int, int, int, int);
    method public void super_setLayoutParams(android.view.ViewGroup.LayoutParams);
    method public void super_startActivityForResult(android.content.Intent, int);
  }

  public final class WebViewDelegate {
    method public void addWebViewAssetPath(android.content.Context);
    method public void callDrawGlFunction(android.graphics.Canvas, long);
    method public void callDrawGlFunction(android.graphics.Canvas, long, java.lang.Runnable);
    method public boolean canInvokeDrawGlFunctor(android.view.View);
    method public void detachDrawGlFunctor(android.view.View, long);
    method public android.app.Application getApplication();
    method public java.lang.String getDataDirectorySuffix();
    method public java.lang.String getErrorString(android.content.Context, int);
    method public int getPackageId(android.content.res.Resources, java.lang.String);
    method public void invokeDrawGlFunctor(android.view.View, long, boolean);
    method public boolean isMultiProcessEnabled();
    method public boolean isTraceTagEnabled();
    method public void setOnTraceEnabledChangeListener(android.webkit.WebViewDelegate.OnTraceEnabledChangeListener);
  }

  public static abstract interface WebViewDelegate.OnTraceEnabledChangeListener {
    method public abstract void onTraceEnabledChange(boolean);
  }

  public final class WebViewFactory {
    ctor public WebViewFactory();
    method public static android.content.pm.PackageInfo getLoadedPackageInfo();
    method public static int loadWebViewNativeLibraryFromPackage(java.lang.String, java.lang.ClassLoader);
    method public static void prepareWebViewInZygote();
    field public static final java.lang.String CHROMIUM_WEBVIEW_VMSIZE_SIZE_PROPERTY = "persist.sys.webview.vmsize";
    field public static final int LIBLOAD_ADDRESS_SPACE_NOT_RESERVED = 2; // 0x2
    field public static final int LIBLOAD_FAILED_JNI_CALL = 7; // 0x7
    field public static final int LIBLOAD_FAILED_LISTING_WEBVIEW_PACKAGES = 4; // 0x4
    field public static final int LIBLOAD_FAILED_TO_FIND_NAMESPACE = 10; // 0xa
    field public static final int LIBLOAD_FAILED_TO_LOAD_LIBRARY = 6; // 0x6
    field public static final int LIBLOAD_FAILED_TO_OPEN_RELRO_FILE = 5; // 0x5
    field public static final int LIBLOAD_FAILED_WAITING_FOR_RELRO = 3; // 0x3
    field public static final int LIBLOAD_FAILED_WAITING_FOR_WEBVIEW_REASON_UNKNOWN = 8; // 0x8
    field public static final int LIBLOAD_SUCCESS = 0; // 0x0
    field public static final int LIBLOAD_WRONG_PACKAGE_NAME = 1; // 0x1
  }

  public abstract interface WebViewFactoryProvider {
    method public abstract android.webkit.WebViewProvider createWebView(android.webkit.WebView, android.webkit.WebView.PrivateAccess);
    method public abstract android.webkit.CookieManager getCookieManager();
    method public abstract android.webkit.GeolocationPermissions getGeolocationPermissions();
    method public abstract android.webkit.ServiceWorkerController getServiceWorkerController();
    method public abstract android.webkit.WebViewFactoryProvider.Statics getStatics();
    method public abstract android.webkit.TokenBindingService getTokenBindingService();
    method public abstract android.webkit.TracingController getTracingController();
    method public abstract android.webkit.WebIconDatabase getWebIconDatabase();
    method public abstract android.webkit.WebStorage getWebStorage();
    method public abstract java.lang.ClassLoader getWebViewClassLoader();
    method public abstract android.webkit.WebViewDatabase getWebViewDatabase(android.content.Context);
  }

  public static abstract interface WebViewFactoryProvider.Statics {
    method public abstract void clearClientCertPreferences(java.lang.Runnable);
    method public abstract void enableSlowWholeDocumentDraw();
    method public abstract java.lang.String findAddress(java.lang.String);
    method public abstract void freeMemoryForTests();
    method public abstract java.lang.String getDefaultUserAgent(android.content.Context);
    method public abstract android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
    method public abstract void initSafeBrowsing(android.content.Context, android.webkit.ValueCallback<java.lang.Boolean>);
    method public abstract android.net.Uri[] parseFileChooserResult(int, android.content.Intent);
    method public abstract void setSafeBrowsingWhitelist(java.util.List<java.lang.String>, android.webkit.ValueCallback<java.lang.Boolean>);
    method public abstract void setWebContentsDebuggingEnabled(boolean);
  }

  public abstract interface WebViewProvider {
    method public abstract void addJavascriptInterface(java.lang.Object, java.lang.String);
    method public abstract boolean canGoBack();
    method public abstract boolean canGoBackOrForward(int);
    method public abstract boolean canGoForward();
    method public abstract boolean canZoomIn();
    method public abstract boolean canZoomOut();
    method public abstract android.graphics.Picture capturePicture();
    method public abstract void clearCache(boolean);
    method public abstract void clearFormData();
    method public abstract void clearHistory();
    method public abstract void clearMatches();
    method public abstract void clearSslPreferences();
    method public abstract void clearView();
    method public abstract android.webkit.WebBackForwardList copyBackForwardList();
    method public abstract android.print.PrintDocumentAdapter createPrintDocumentAdapter(java.lang.String);
    method public abstract android.webkit.WebMessagePort[] createWebMessageChannel();
    method public abstract void destroy();
    method public abstract void documentHasImages(android.os.Message);
    method public abstract void dumpViewHierarchyWithProperties(java.io.BufferedWriter, int);
    method public abstract void evaluateJavaScript(java.lang.String, android.webkit.ValueCallback<java.lang.String>);
    method public abstract int findAll(java.lang.String);
    method public abstract void findAllAsync(java.lang.String);
    method public abstract android.view.View findHierarchyView(java.lang.String, int);
    method public abstract void findNext(boolean);
    method public abstract void flingScroll(int, int);
    method public abstract void freeMemory();
    method public abstract android.net.http.SslCertificate getCertificate();
    method public abstract int getContentHeight();
    method public abstract int getContentWidth();
    method public abstract android.graphics.Bitmap getFavicon();
    method public abstract android.webkit.WebView.HitTestResult getHitTestResult();
    method public abstract java.lang.String[] getHttpAuthUsernamePassword(java.lang.String, java.lang.String);
    method public abstract java.lang.String getOriginalUrl();
    method public abstract int getProgress();
    method public abstract boolean getRendererPriorityWaivedWhenNotVisible();
    method public abstract int getRendererRequestedPriority();
    method public abstract float getScale();
    method public abstract android.webkit.WebViewProvider.ScrollDelegate getScrollDelegate();
    method public abstract android.webkit.WebSettings getSettings();
    method public default android.view.textclassifier.TextClassifier getTextClassifier();
    method public abstract java.lang.String getTitle();
    method public abstract java.lang.String getTouchIconUrl();
    method public abstract java.lang.String getUrl();
    method public abstract android.webkit.WebViewProvider.ViewDelegate getViewDelegate();
    method public abstract int getVisibleTitleHeight();
    method public abstract android.webkit.WebChromeClient getWebChromeClient();
    method public abstract android.webkit.WebViewClient getWebViewClient();
    method public abstract android.view.View getZoomControls();
    method public abstract void goBack();
    method public abstract void goBackOrForward(int);
    method public abstract void goForward();
    method public abstract void init(java.util.Map<java.lang.String, java.lang.Object>, boolean);
    method public abstract void insertVisualStateCallback(long, android.webkit.WebView.VisualStateCallback);
    method public abstract void invokeZoomPicker();
    method public abstract boolean isPaused();
    method public abstract boolean isPrivateBrowsingEnabled();
    method public abstract void loadData(java.lang.String, java.lang.String, java.lang.String);
    method public abstract void loadDataWithBaseURL(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String);
    method public abstract void loadUrl(java.lang.String, java.util.Map<java.lang.String, java.lang.String>);
    method public abstract void loadUrl(java.lang.String);
    method public abstract void notifyFindDialogDismissed();
    method public abstract void onPause();
    method public abstract void onResume();
    method public abstract boolean overlayHorizontalScrollbar();
    method public abstract boolean overlayVerticalScrollbar();
    method public abstract boolean pageDown(boolean);
    method public abstract boolean pageUp(boolean);
    method public abstract void pauseTimers();
    method public abstract void postMessageToMainFrame(android.webkit.WebMessage, android.net.Uri);
    method public abstract void postUrl(java.lang.String, byte[]);
    method public abstract void reload();
    method public abstract void removeJavascriptInterface(java.lang.String);
    method public abstract void requestFocusNodeHref(android.os.Message);
    method public abstract void requestImageRef(android.os.Message);
    method public abstract boolean restorePicture(android.os.Bundle, java.io.File);
    method public abstract android.webkit.WebBackForwardList restoreState(android.os.Bundle);
    method public abstract void resumeTimers();
    method public abstract void savePassword(java.lang.String, java.lang.String, java.lang.String);
    method public abstract boolean savePicture(android.os.Bundle, java.io.File);
    method public abstract android.webkit.WebBackForwardList saveState(android.os.Bundle);
    method public abstract void saveWebArchive(java.lang.String);
    method public abstract void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>);
    method public abstract void setCertificate(android.net.http.SslCertificate);
    method public abstract void setDownloadListener(android.webkit.DownloadListener);
    method public abstract void setFindListener(android.webkit.WebView.FindListener);
    method public abstract void setHorizontalScrollbarOverlay(boolean);
    method public abstract void setHttpAuthUsernamePassword(java.lang.String, java.lang.String, java.lang.String, java.lang.String);
    method public abstract void setInitialScale(int);
    method public abstract void setMapTrackballToArrowKeys(boolean);
    method public abstract void setNetworkAvailable(boolean);
    method public abstract void setPictureListener(android.webkit.WebView.PictureListener);
    method public abstract void setRendererPriorityPolicy(int, boolean);
    method public default void setTextClassifier(android.view.textclassifier.TextClassifier);
    method public abstract void setVerticalScrollbarOverlay(boolean);
    method public abstract void setWebChromeClient(android.webkit.WebChromeClient);
    method public abstract void setWebViewClient(android.webkit.WebViewClient);
    method public abstract boolean showFindDialog(java.lang.String, boolean);
    method public abstract void stopLoading();
    method public abstract boolean zoomBy(float);
    method public abstract boolean zoomIn();
    method public abstract boolean zoomOut();
  }

  public static abstract interface WebViewProvider.ScrollDelegate {
    method public abstract int computeHorizontalScrollOffset();
    method public abstract int computeHorizontalScrollRange();
    method public abstract void computeScroll();
    method public abstract int computeVerticalScrollExtent();
    method public abstract int computeVerticalScrollOffset();
    method public abstract int computeVerticalScrollRange();
  }

  public static abstract interface WebViewProvider.ViewDelegate {
    method public default void autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
    method public abstract boolean dispatchKeyEvent(android.view.KeyEvent);
    method public abstract android.view.View findFocus(android.view.View);
    method public abstract android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider();
    method public abstract android.os.Handler getHandler(android.os.Handler);
    method public default boolean isVisibleToUserForAutofill(int);
    method public abstract void onActivityResult(int, int, android.content.Intent);
    method public abstract void onAttachedToWindow();
    method public default boolean onCheckIsTextEditor();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
    method public abstract android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo);
    method public abstract void onDetachedFromWindow();
    method public abstract boolean onDragEvent(android.view.DragEvent);
    method public abstract void onDraw(android.graphics.Canvas);
    method public abstract void onDrawVerticalScrollBar(android.graphics.Canvas, android.graphics.drawable.Drawable, int, int, int, int);
    method public abstract void onFinishTemporaryDetach();
    method public abstract void onFocusChanged(boolean, int, android.graphics.Rect);
    method public abstract boolean onGenericMotionEvent(android.view.MotionEvent);
    method public abstract boolean onHoverEvent(android.view.MotionEvent);
    method public abstract void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
    method public abstract void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo);
    method public abstract boolean onKeyDown(int, android.view.KeyEvent);
    method public abstract boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public abstract boolean onKeyUp(int, android.view.KeyEvent);
    method public abstract void onMeasure(int, int);
    method public default void onMovedToDisplay(int, android.content.res.Configuration);
    method public abstract void onOverScrolled(int, int, boolean, boolean);
    method public default void onProvideAutofillVirtualStructure(android.view.ViewStructure, int);
    method public abstract void onProvideVirtualStructure(android.view.ViewStructure);
    method public abstract void onScrollChanged(int, int, int, int);
    method public abstract void onSizeChanged(int, int, int, int);
    method public abstract void onStartTemporaryDetach();
    method public abstract boolean onTouchEvent(android.view.MotionEvent);
    method public abstract boolean onTrackballEvent(android.view.MotionEvent);
    method public abstract void onVisibilityChanged(android.view.View, int);
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract void onWindowVisibilityChanged(int);
    method public abstract boolean performAccessibilityAction(int, android.os.Bundle);
    method public abstract boolean performLongClick();
    method public abstract void preDispatchDraw(android.graphics.Canvas);
    method public abstract boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean);
    method public abstract boolean requestFocus(int, android.graphics.Rect);
    method public abstract void setBackgroundColor(int);
    method public abstract boolean setFrame(int, int, int, int);
    method public abstract void setLayerType(int, android.graphics.Paint);
    method public abstract void setLayoutParams(android.view.ViewGroup.LayoutParams);
    method public abstract void setOverScrollMode(int);
    method public abstract void setScrollBarStyle(int);
    method public abstract boolean shouldDelayChildPressedState();
  }

  public final class WebViewProviderInfo implements android.os.Parcelable {
    ctor public WebViewProviderInfo(java.lang.String, java.lang.String, boolean, boolean, java.lang.String[]);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.webkit.WebViewProviderInfo> CREATOR;
    field public final boolean availableByDefault;
    field public final java.lang.String description;
    field public final boolean isFallback;
    field public final java.lang.String packageName;
    field public final android.content.pm.Signature[] signatures;
  }

  public final class WebViewUpdateService {
    method public static android.webkit.WebViewProviderInfo[] getAllWebViewPackages();
    method public static java.lang.String getCurrentWebViewPackageName();
    method public static android.webkit.WebViewProviderInfo[] getValidWebViewPackages();
  }

}

