Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

permissions.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. var permissionsName = 'Permissions';
  2. function Permissions() {
  3. this.ACCESS_CHECKIN_PROPERTIES = 'android.permission.ACCESS_CHECKIN_PROPERTIES';
  4. this.ACCESS_COARSE_LOCATION = 'android.permission.ACCESS_COARSE_LOCATION';
  5. this.ACCESS_FINE_LOCATION = 'android.permission.ACCESS_FINE_LOCATION';
  6. this.ACCESS_LOCATION_EXTRA_COMMANDS = 'android.permission.ACCESS_LOCATION_EXTRA_COMMANDS';
  7. this.ACCESS_MOCK_LOCATION = 'android.permission.ACCESS_MOCK_LOCATION';
  8. this.ACCESS_NETWORK_STATE = 'android.permission.ACCESS_NETWORK_STATE';
  9. this.ACCESS_SURFACE_FLINGER = 'android.permission.ACCESS_SURFACE_FLINGER';
  10. this.ACCESS_WIFI_STATE = 'android.permission.ACCESS_WIFI_STATE';
  11. this.ACCOUNT_MANAGER = 'android.permission.ACCOUNT_MANAGER';
  12. this.ADD_VOICEMAIL = 'com.android.voicemail.permission.ADD_VOICEMAIL';
  13. this.AUTHENTICATE_ACCOUNTS = 'android.permission.AUTHENTICATE_ACCOUNTS';
  14. this.BATTERY_STATS = 'android.permission.BATTERY_STATS';
  15. this.BIND_ACCESSIBILITY_SERVICE = 'android.permission.BIND_ACCESSIBILITY_SERVICE';
  16. this.BIND_APPWIDGET = 'android.permission.BIND_APPWIDGET';
  17. this.BIND_CARRIER_MESSAGING_SERVICE = 'android.permission.BIND_CARRIER_MESSAGING_SERVICE';
  18. this.BIND_DEVICE_ADMIN = 'android.permission.BIND_DEVICE_ADMIN';
  19. this.BIND_DREAM_SERVICE = 'android.permission.BIND_DREAM_SERVICE';
  20. this.BIND_INPUT_METHOD = 'android.permission.BIND_INPUT_METHOD';
  21. this.BIND_NFC_SERVICE = 'android.permission.BIND_NFC_SERVICE';
  22. this.BIND_NOTIFICATION_LISTENER_SERVICE = 'android.permission.BIND_NOTIFICATION_LISTENER_SERVICE';
  23. this.BIND_PRINT_SERVICE = 'android.permission.BIND_PRINT_SERVICE';
  24. this.BIND_REMOTEVIEWS = 'android.permission.BIND_REMOTEVIEWS';
  25. this.BIND_TEXT_SERVICE = 'android.permission.BIND_TEXT_SERVICE';
  26. this.BIND_TV_INPUT = 'android.permission.BIND_TV_INPUT';
  27. this.BIND_VOICE_INTERACTION = 'android.permission.BIND_VOICE_INTERACTION';
  28. this.BIND_VPN_SERVICE = 'android.permission.BIND_VPN_SERVICE';
  29. this.BIND_WALLPAPER = 'android.permission.BIND_WALLPAPER';
  30. this.BLUETOOTH = 'android.permission.BLUETOOTH';
  31. this.BLUETOOTH_ADMIN = 'android.permission.BLUETOOTH_ADMIN';
  32. this.BLUETOOTH_PRIVILEGED = 'android.permission.BLUETOOTH_PRIVILEGED';
  33. this.BODY_SENSORS = 'android.permission.BODY_SENSORS';
  34. this.BRICK = 'android.permission.BRICK';
  35. this.BROADCAST_PACKAGE_REMOVED = 'android.permission.BROADCAST_PACKAGE_REMOVED';
  36. this.BROADCAST_SMS = 'android.permission.BROADCAST_SMS';
  37. this.BROADCAST_STICKY = 'android.permission.BROADCAST_STICKY';
  38. this.BROADCAST_WAP_PUSH = 'android.permission.BROADCAST_WAP_PUSH';
  39. this.CALL_PHONE = 'android.permission.CALL_PHONE';
  40. this.CALL_PRIVILEGED = 'android.permission.CALL_PRIVILEGED';
  41. this.CAMERA = 'android.permission.CAMERA';
  42. this.CAPTURE_AUDIO_OUTPUT = 'android.permission.CAPTURE_AUDIO_OUTPUT';
  43. this.CAPTURE_SECURE_VIDEO_OUTPUT = 'android.permission.CAPTURE_SECURE_VIDEO_OUTPUT';
  44. this.CAPTURE_VIDEO_OUTPUT = 'android.permission.CAPTURE_VIDEO_OUTPUT';
  45. this.CHANGE_COMPONENT_ENABLED_STATE = 'android.permission.CHANGE_COMPONENT_ENABLED_STATE';
  46. this.CHANGE_CONFIGURATION = 'android.permission.CHANGE_CONFIGURATION';
  47. this.CHANGE_NETWORK_STATE = 'android.permission.CHANGE_NETWORK_STATE';
  48. this.CHANGE_WIFI_MULTICAST_STATE = 'android.permission.CHANGE_WIFI_MULTICAST_STATE';
  49. this.CHANGE_WIFI_STATE = 'android.permission.CHANGE_WIFI_STATE';
  50. this.CLEAR_APP_CACHE = 'android.permission.CLEAR_APP_CACHE';
  51. this.CLEAR_APP_USER_DATA = 'android.permission.CLEAR_APP_USER_DATA';
  52. this.CONTROL_LOCATION_UPDATES = 'android.permission.CONTROL_LOCATION_UPDATES';
  53. this.DELETE_CACHE_FILES = 'android.permission.DELETE_CACHE_FILES';
  54. this.DELETE_PACKAGES = 'android.permission.DELETE_PACKAGES';
  55. this.DEVICE_POWER = 'android.permission.DEVICE_POWER';
  56. this.DIAGNOSTIC = 'android.permission.DIAGNOSTIC';
  57. this.DISABLE_KEYGUARD = 'android.permission.DISABLE_KEYGUARD';
  58. this.DUMP = 'android.permission.DUMP';
  59. this.EXPAND_STATUS_BAR = 'android.permission.EXPAND_STATUS_BAR';
  60. this.FACTORY_TEST = 'android.permission.FACTORY_TEST';
  61. this.FLASHLIGHT = 'android.permission.FLASHLIGHT';
  62. this.FORCE_BACK = 'android.permission.FORCE_BACK';
  63. this.GET_ACCOUNTS = 'android.permission.GET_ACCOUNTS';
  64. this.GET_PACKAGE_SIZE = 'android.permission.GET_PACKAGE_SIZE';
  65. this.GET_TASKS = 'android.permission.GET_TASKS';
  66. this.GET_TOP_ACTIVITY_INFO = 'android.permission.GET_TOP_ACTIVITY_INFO';
  67. this.GLOBAL_SEARCH = 'android.permission.GLOBAL_SEARCH';
  68. this.HARDWARE_TEST = 'android.permission.HARDWARE_TEST';
  69. this.INJECT_EVENTS = 'android.permission.INJECT_EVENTS';
  70. this.INSTALL_LOCATION_PROVIDER = 'android.permission.INSTALL_LOCATION_PROVIDER';
  71. this.INSTALL_PACKAGES = 'android.permission.INSTALL_PACKAGES';
  72. this.INSTALL_SHORTCUT = 'com.android.launcher.permission.INSTALL_SHORTCUT';
  73. this.INTERNAL_SYSTEM_WINDOW = 'android.permission.INTERNAL_SYSTEM_WINDOW';
  74. this.INTERNET = 'android.permission.INTERNET';
  75. this.KILL_BACKGROUND_PROCESSES = 'android.permission.KILL_BACKGROUND_PROCESSES';
  76. this.LOCATION_HARDWARE = 'android.permission.LOCATION_HARDWARE';
  77. this.MANAGE_ACCOUNTS = 'android.permission.MANAGE_ACCOUNTS';
  78. this.MANAGE_APP_TOKENS = 'android.permission.MANAGE_APP_TOKENS';
  79. this.MANAGE_DOCUMENTS = 'android.permission.MANAGE_DOCUMENTS';
  80. this.MASTER_CLEAR = 'android.permission.MASTER_CLEAR';
  81. this.MEDIA_CONTENT_CONTROL = 'android.permission.MEDIA_CONTENT_CONTROL';
  82. this.MODIFY_AUDIO_SETTINGS = 'android.permission.MODIFY_AUDIO_SETTINGS';
  83. this.MODIFY_PHONE_STATE = 'android.permission.MODIFY_PHONE_STATE';
  84. this.MOUNT_FORMAT_FILESYSTEMS = 'android.permission.MOUNT_FORMAT_FILESYSTEMS';
  85. this.MOUNT_UNMOUNT_FILESYSTEMS = 'android.permission.MOUNT_UNMOUNT_FILESYSTEMS';
  86. this.NFC = 'android.permission.NFC';
  87. this.PERSISTENT_ACTIVITY = 'android.permission.PERSISTENT_ACTIVITY';
  88. this.PROCESS_OUTGOING_CALLS = 'android.permission.PROCESS_OUTGOING_CALLS';
  89. this.READ_CALENDAR = 'android.permission.READ_CALENDAR';
  90. this.READ_CALL_LOG = 'android.permission.READ_CALL_LOG';
  91. this.READ_CONTACTS = 'android.permission.READ_CONTACTS';
  92. this.READ_EXTERNAL_STORAGE = 'android.permission.READ_EXTERNAL_STORAGE';
  93. this.READ_FRAME_BUFFER = 'android.permission.READ_FRAME_BUFFER';
  94. this.READ_HISTORY_BOOKMARKS = 'com.android.browser.permission.READ_HISTORY_BOOKMARKS';
  95. this.READ_INPUT_STATE = 'android.permission.READ_INPUT_STATE';
  96. this.READ_LOGS = 'android.permission.READ_LOGS';
  97. this.READ_PHONE_STATE = 'android.permission.READ_PHONE_STATE';
  98. this.READ_PROFILE = 'android.permission.READ_PROFILE';
  99. this.READ_SMS = 'android.permission.READ_SMS';
  100. this.READ_SOCIAL_STREAM = 'android.permission.READ_SOCIAL_STREAM';
  101. this.READ_SYNC_SETTINGS = 'android.permission.READ_SYNC_SETTINGS';
  102. this.READ_SYNC_STATS = 'android.permission.READ_SYNC_STATS';
  103. this.READ_USER_DICTIONARY = 'android.permission.READ_USER_DICTIONARY';
  104. this.READ_VOICEMAIL = 'com.android.voicemail.permission.READ_VOICEMAIL';
  105. this.REBOOT = 'android.permission.REBOOT';
  106. this.RECEIVE_BOOT_COMPLETED = 'android.permission.RECEIVE_BOOT_COMPLETED';
  107. this.RECEIVE_MMS = 'android.permission.RECEIVE_MMS';
  108. this.RECEIVE_SMS = 'android.permission.RECEIVE_SMS';
  109. this.RECEIVE_WAP_PUSH = 'android.permission.RECEIVE_WAP_PUSH';
  110. this.RECORD_AUDIO = 'android.permission.RECORD_AUDIO';
  111. this.REORDER_TASKS = 'android.permission.REORDER_TASKS';
  112. this.RESTART_PACKAGES = 'android.permission.RESTART_PACKAGES';
  113. this.SEND_RESPOND_VIA_MESSAGE = 'android.permission.SEND_RESPOND_VIA_MESSAGE';
  114. this.SEND_SMS = 'android.permission.SEND_SMS';
  115. this.SET_ACTIVITY_WATCHER = 'android.permission.SET_ACTIVITY_WATCHER';
  116. this.SET_ALARM = 'com.android.alarm.permission.SET_ALARM';
  117. this.SET_ALWAYS_FINISH = 'android.permission.SET_ALWAYS_FINISH';
  118. this.SET_ANIMATION_SCALE = 'android.permission.SET_ANIMATION_SCALE';
  119. this.SET_DEBUG_APP = 'android.permission.SET_DEBUG_APP';
  120. this.SET_ORIENTATION = 'android.permission.SET_ORIENTATION';
  121. this.SET_POINTER_SPEED = 'android.permission.SET_POINTER_SPEED';
  122. this.SET_PREFERRED_APPLICATIONS = 'android.permission.SET_PREFERRED_APPLICATIONS';
  123. this.SET_PROCESS_LIMIT = 'android.permission.SET_PROCESS_LIMIT';
  124. this.SET_TIME = 'android.permission.SET_TIME';
  125. this.SET_TIME_ZONE = 'android.permission.SET_TIME_ZONE';
  126. this.SET_WALLPAPER = 'android.permission.SET_WALLPAPER';
  127. this.SET_WALLPAPER_HINTS = 'android.permission.SET_WALLPAPER_HINTS';
  128. this.SIGNAL_PERSISTENT_PROCESSES = 'android.permission.SIGNAL_PERSISTENT_PROCESSES';
  129. this.STATUS_BAR = 'android.permission.STATUS_BAR';
  130. this.SUBSCRIBED_FEEDS_READ = 'android.permission.SUBSCRIBED_FEEDS_READ';
  131. this.SUBSCRIBED_FEEDS_WRITE = 'android.permission.SUBSCRIBED_FEEDS_WRITE';
  132. this.SYSTEM_ALERT_WINDOW = 'android.permission.SYSTEM_ALERT_WINDOW';
  133. this.TRANSMIT_IR = 'android.permission.TRANSMIT_IR';
  134. this.UNINSTALL_SHORTCUT = 'com.android.launcher.permission.UNINSTALL_SHORTCUT';
  135. this.UPDATE_DEVICE_STATS = 'android.permission.UPDATE_DEVICE_STATS';
  136. this.USE_CREDENTIALS = 'android.permission.USE_CREDENTIALS';
  137. this.USE_SIP = 'android.permission.USE_SIP';
  138. this.VIBRATE = 'android.permission.VIBRATE';
  139. this.WAKE_LOCK = 'android.permission.WAKE_LOCK';
  140. this.WRITE_APN_SETTINGS = 'android.permission.WRITE_APN_SETTINGS';
  141. this.WRITE_CALENDAR = 'android.permission.WRITE_CALENDAR';
  142. this.WRITE_CALL_LOG = 'android.permission.WRITE_CALL_LOG';
  143. this.WRITE_CONTACTS = 'android.permission.WRITE_CONTACTS';
  144. this.WRITE_EXTERNAL_STORAGE = 'android.permission.WRITE_EXTERNAL_STORAGE';
  145. this.WRITE_GSERVICES = 'android.permission.WRITE_GSERVICES';
  146. this.WRITE_HISTORY_BOOKMARKS = 'com.android.browser.permission.WRITE_HISTORY_BOOKMARKS';
  147. this.WRITE_PROFILE = 'android.permission.WRITE_PROFILE';
  148. this.WRITE_SECURE_SETTINGS = 'android.permission.WRITE_SECURE_SETTINGS';
  149. this.WRITE_SETTINGS = 'android.permission.WRITE_SETTINGS';
  150. this.WRITE_SMS = 'android.permission.WRITE_SMS';
  151. this.WRITE_SOCIAL_STREAM = 'android.permission.WRITE_SOCIAL_STREAM';
  152. this.WRITE_SYNC_SETTINGS = 'android.permission.WRITE_SYNC_SETTINGS';
  153. this.WRITE_USER_DICTIONARY = 'android.permission.WRITE_USER_DICTIONARY';
  154. this.WRITE_VOICEMAIL = 'com.android.voicemail.permission.WRITE_VOICEMAIL';
  155. }
  156. function deprecated(name) {
  157. console.warn("Calling cordova.plugins.permissions." + name + " with the successCallback as first argument is deprecated");
  158. console.warn("The new signature is '" + name + "(permission, successCallback, errorCallback)'");
  159. }
  160. Permissions.prototype = {
  161. checkPermission: function(permission, successCallback, errorCallback) {
  162. cordova.exec(successCallback, errorCallback, permissionsName, 'checkPermission', [permission]);
  163. },
  164. requestPermission: function(permission, successCallback, errorCallback) {
  165. if (typeof permission === "function") {
  166. deprecated("requestPermission");
  167. successCallback = arguments[0];
  168. errorCallback = arguments[1];
  169. permission = arguments[2];
  170. }
  171. cordova.exec(successCallback, errorCallback, permissionsName, 'requestPermission', [permission]);
  172. },
  173. requestPermissions: function(permissions, successCallback, errorCallback) {
  174. cordova.exec(successCallback, errorCallback, permissionsName, 'requestPermissions', permissions);
  175. }
  176. };
  177. Permissions.prototype.hasPermission = function (permission, successCallback, errorCallback) {
  178. console.warn("hasPermission() function deprecated. Considers using checkPermission()");
  179. if (typeof permission === "function") {
  180. deprecated("hasPermission");
  181. successCallback = arguments[0];
  182. errorCallback = arguments[1];
  183. permission = arguments[2];
  184. }
  185. this.checkPermission.call(this, permission, successCallback, errorCallback);
  186. };
  187. module.exports = new Permissions();