package android {

  public static final class Manifest.permission {
    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_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_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_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 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_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 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 = 16844165; // 0x1010585
  }

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

  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 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 = "bind_accessibility_service";
    field public static final java.lang.String OPSTR_CHANGE_WIFI_STATE = "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_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 = "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_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 class BroadcastOptions {
    method public static android.app.BroadcastOptions makeBasic();
    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 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 boolean addConfiguration(long, byte[], java.lang.String, java.lang.String);
    method public boolean addConfiguration(long, byte[]);
    method public byte[] getData(long);
    method public byte[] getMetadata();
    method public boolean removeConfiguration(long);
    method public boolean setBroadcastSubscriber(long, long, android.app.PendingIntent);
    method public boolean setDataFetchOperation(long, android.app.PendingIntent);
    field public static final java.lang.String ACTION_STATSD_STARTED = "android.app.action.STATSD_STARTED";
    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 class VrManager {
    method public void setAndBindVrCompositor(android.content.ComponentName);
    method public void setPersistentVrModeEnabled(boolean);
  }

  public class WallpaperManager {
    method public void clearWallpaper();
    method public void clearWallpaper(int, int);
    method public void setDisplayOffset(android.os.IBinder, int, int);
    method public void setDisplayPadding(android.graphics.Rect);
    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 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.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 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 int getStandbyBucket();
    field public static final int NOTIFICATION_SEEN = 10; // 0xa
    field public static final int STANDBY_BUCKET_CHANGED = 11; // 0xb
  }

  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 setAppStandbyBucket(java.lang.String, int);
    method public void setAppStandbyBuckets(java.util.Map<java.lang.String, java.lang.Integer>);
    method public void whitelistAppTemporarily(java.lang.String, long, android.os.UserHandle);
    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_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 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 java.lang.CharSequence loadSafeLabel(android.content.pm.PackageManager);
  }

  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 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 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 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 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.BrightnessChangeEvent> getBrightnessEvents();
    method public android.graphics.Point getStableDisplaySize();
    method public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
  }

}

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 {
    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 {
    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 {
    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 {
    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 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_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_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.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 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 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 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 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 close();
    method public java.lang.String getInterfaceName();
  }

  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 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 final class ConfigUpdate {
    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);
    method public void reportIncident(java.lang.String, byte[]);
  }

  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 static android.os.IncidentReportArgs parseSetting(java.lang.String) throws java.lang.IllegalArgumentException;
    method public void readFromParcel(android.os.Parcel);
    method public int sectionCount();
    method public void setAll(boolean);
    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 AUTOFILL_COMPAT_ALLOWED_PACKAGES = "autofill_compat_allowed_packages";
    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 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 INSTANT_APPS_ENABLED = "instant_apps_enabled";
  }

  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_CUSTOM_PASSWORD = 101; // 0x65
    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 byte[] getTrustedHardwarePublicKey();
    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 createSha256Params(byte[]);
    method public int describeContents();
    method public int getAlgorithm();
    method public byte[] getSalt();
    method public void writeToParcel(android.os.Parcel, int);
    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 byte[] generateAndStoreKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
    method public java.util.List<java.lang.String> getAliases(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public static android.security.keystore.recovery.RecoveryController getInstance(android.content.Context);
    method public int[] getPendingRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void initRecoveryService(java.lang.String, byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
    method public void recoverySecretAvailable(android.security.keystore.recovery.KeyChainProtectionParams) throws android.security.keystore.recovery.InternalRecoveryServiceException;
    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, byte[]> recoverKeys(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(byte[], 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 byte[] getAccount();
    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 setAccount(byte[]);
    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 SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService";
    field public static final java.lang.String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms";
    field public static final 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_PEOPLE = "key_people";
    field public static final java.lang.String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
    field public static final java.lang.String KEY_USER_SENTIMENT = "key_user_sentiment";
  }

  public 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.os.IBinder onBind(android.content.Intent);
    method public abstract void onClassifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
    method public abstract void onGenerateLinks(java.lang.CharSequence, android.view.textclassifier.TextLinks.Options, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
    method public abstract void onSuggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options, 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 {
    ctor public 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 getReasonForDenial();
    method public int getRegState();
    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 {
    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.Pair<java.time.ZonedDateTime, 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 createRecurringDaily(java.time.ZonedDateTime);
    method public static android.telephony.SubscriptionPlan.Builder createRecurringMonthly(java.time.ZonedDateTime);
    method public static 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);
    method public int describeContents();
    method public java.lang.String getCardId();
    method public int getCardStateInfo();
    method public boolean getIsActive();
    method public boolean getIsEuicc();
    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 {
    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_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 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_SUBSCRIPTION = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION";
    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 {
    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 {
    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 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 {
    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_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_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();
    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();
    method public int describeContents();
    method public java.lang.String getIcbNum();
    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
  }

  public final class ImsStreamMediaProfile implements android.os.Parcelable {
    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 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_EMERGENCY_CSFB = 2; // 0x2
    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 {
    ctor public ImsFeatureConfiguration();
    method public int describeContents();
    method public int[] 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);
    method public android.telephony.ims.stub.ImsFeatureConfiguration build();
  }

  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 = 2; // 0x2
    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 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 registerStateCallback(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback) 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;
    method public int unregisterStateCallback(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback) 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 abstract void onActivityResult(int, int, android.content.Intent);
    method public abstract void onAttachedToWindow();
    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();
  }

}

