adb
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| adb [2018/07/23 13:12] – [Supprimer une application] simon | adb [2026/08/22 15:34] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== Adb ====== | ||
| - | Un [[https:// | ||
| - | |||
| - | ===== Mettre son smartphone en "mode debug" ===== | ||
| - | [[https:// | ||
| - | |||
| - | Il faut aller dans les **Paramètres**, | ||
| - | (Ça donne l' | ||
| - | |||
| - | Dans le menu pour les développeurs, | ||
| - | |||
| - | ===== Installer adb ===== | ||
| - | <code bash> | ||
| - | $ sudo apt install adb | ||
| - | </ | ||
| - | |||
| - | ===== Jouer avec adb ===== | ||
| - | ==== Liste des appareils branchés ==== | ||
| - | J'ai du lancer plusieurs fois la commande : | ||
| - | <code bash> | ||
| - | $ adb devices | ||
| - | List of devices attached | ||
| - | * daemon not running. starting it now on port 5037 * | ||
| - | free(): invalid next size (fast) | ||
| - | ADB server didn't ACK | ||
| - | * failed to start daemon * | ||
| - | error: cannot connect to daemon | ||
| - | |||
| - | $ adb devices | ||
| - | List of devices attached | ||
| - | * daemon not running. starting it now on port 5037 * | ||
| - | * daemon started successfully * | ||
| - | BJ030262 unauthorized | ||
| - | </ | ||
| - | |||
| - | Un pop-up apparait sur le téléphone pour demander si on autorise l' | ||
| - | <code bash> | ||
| - | $ adb devices | ||
| - | List of devices attached | ||
| - | BJ030262 device | ||
| - | </ | ||
| - | |||
| - | ==== Voir les logs du téléphone ==== | ||
| - | La commande " | ||
| - | <code bash> | ||
| - | $ adb logcat | ||
| - | </ | ||
| - | |||
| - | ==== Se connecter sur le téléphone ==== | ||
| - | <code bash> | ||
| - | $ adb shell | ||
| - | 1|bardock:/ $ | ||
| - | </ | ||
| - | |||
| - | Liste des programmes installés sur le téléphone : | ||
| - | <code bash> | ||
| - | $ a | ||
| - | acpi | ||
| - | alias antradio_app | ||
| - | |||
| - | $ b | ||
| - | base64 | ||
| - | basename | ||
| - | |||
| - | $ c | ||
| - | cal chcon chroot | ||
| - | case | ||
| - | cat chgrp clear content | ||
| - | cd | ||
| - | chamomile_provision | ||
| - | |||
| - | $ d | ||
| - | dalvikvm | ||
| - | dalvikvm32 | ||
| - | dalvikvm64 | ||
| - | date df done | ||
| - | dd diag_callback_sample | ||
| - | |||
| - | $ e | ||
| - | e_loop | ||
| - | ebtables | ||
| - | |||
| - | $ f | ||
| - | fallocate | ||
| - | false fi | ||
| - | fc | ||
| - | fg | ||
| - | |||
| - | $ g | ||
| - | getenforce | ||
| - | getevent | ||
| - | |||
| - | $ h | ||
| - | hash | ||
| - | |||
| - | $ i | ||
| - | id | ||
| - | if | ||
| - | ifconfig | ||
| - | iftop input ionice | ||
| - | |||
| - | $ j | ||
| - | jobs | ||
| - | |||
| - | $ k | ||
| - | kill | ||
| - | |||
| - | $ l | ||
| - | ld.mc linker | ||
| - | let linker64 | ||
| - | let] | ||
| - | |||
| - | $ m | ||
| - | make_ext4fs | ||
| - | make_f2fs | ||
| - | md5sum | ||
| - | media mm-qcamera-app | ||
| - | mkdir mm-qjpeg-dec-test | ||
| - | |||
| - | $ n | ||
| - | nameref | ||
| - | |||
| - | $ o | ||
| - | oatdump | ||
| - | |||
| - | $ p | ||
| - | paste | ||
| - | patch | ||
| - | |||
| - | $ q | ||
| - | qjpeg-dma-test | ||
| - | |||
| - | $ r | ||
| - | r readlink | ||
| - | radish | ||
| - | read | ||
| - | |||
| - | $ s | ||
| - | schedtest | ||
| - | screencap | ||
| - | screenrecord | ||
| - | secdiscard | ||
| - | sed service | ||
| - | select | ||
| - | |||
| - | $ t | ||
| - | tac telecom | ||
| - | tail | ||
| - | tar test_module_pproc | ||
| - | taskset | ||
| - | tc | ||
| - | tee timeout | ||
| - | |||
| - | $ u | ||
| - | uiautomator | ||
| - | ulimit | ||
| - | |||
| - | $ v | ||
| - | vendor_cmd_tool | ||
| - | |||
| - | $ w | ||
| - | wait | ||
| - | |||
| - | $ x | ||
| - | xargs xxd | ||
| - | |||
| - | $ y | ||
| - | (rien) | ||
| - | |||
| - | $ z | ||
| - | (rien) | ||
| - | </ | ||
| - | |||
| - | ==== Récupérer la liste des applications installées ==== | ||
| - | <code bash> | ||
| - | 1|bardock:/ $ pm list packages | ||
| - | package: | ||
| - | (...) | ||
| - | package: | ||
| - | </ | ||
| - | |||
| - | On peut bien évidemment filtrer cette liste avec [[grep]] : | ||
| - | <code bash> | ||
| - | bardock:/ $ pm list packages | grep google | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | package: | ||
| - | </ | ||
| - | |||
| - | Si je regarde un peu les applications qui sont désactivées dans mon téléphones, | ||
| - | * L' | ||
| - | * L' | ||
| - | * Chrome (J' | ||
| - | * Clavier Google (J' | ||
| - | * Contacts (J' | ||
| - | * Drive (J' | ||
| - | * Duo | ||
| - | * Gmail | ||
| - | * Google Play Musique | ||
| - | * Google Play Films et séries | ||
| - | |||
| - | * Hangouts | ||
| - | * Magnétophone | ||
| - | * Maps | ||
| - | * Messages (J' | ||
| - | * Photos (J' | ||
| - | * YouTube (J' | ||
| - | |||
| - | ==== Avoir plus d' | ||
| - | <code bash> | ||
| - | bardock:/ $ dumpsys | grep -A 50 " | ||
| - | Can't find service: android.service.gatekeeper.IGateKeeperService | ||
| - | Can't find service: netd | ||
| - | Package [com.google.android.youtube] (8fe1a80): | ||
| - | userId=10090 | ||
| - | pkg=Package{ac2e252 com.google.android.youtube} | ||
| - | codePath=/ | ||
| - | resourcePath=/ | ||
| - | legacyNativeLibraryDir=/ | ||
| - | primaryCpuAbi=arm64-v8a | ||
| - | secondaryCpuAbi=null | ||
| - | versionCode=1307553400 minSdk=21 targetSdk=26 | ||
| - | versionName=13.07.55 | ||
| - | splits=[base] | ||
| - | apkSigningVersion=1 | ||
| - | applicationInfo=ApplicationInfo{15f5ad5 com.google.android.youtube} | ||
| - | flags=[ SYSTEM HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP KILL_AFTER_RESTORE RESTORE_ANY_VERSION LARGE_HEAP ] | ||
| - | privateFlags=[ HAS_DOMAIN_URLS RESIZEABLE_ACTIVITIES ] | ||
| - | dataDir=/ | ||
| - | supportsScreens=[small, | ||
| - | timeStamp=2009-01-01 00:00:00 | ||
| - | firstInstallTime=2009-01-01 00:00:00 | ||
| - | lastUpdateTime=2009-01-01 00:00:00 | ||
| - | signatures=PackageSignatures{35b8923 [7d3bce25]} | ||
| - | installPermissionsFixed=false installStatus=1 | ||
| - | pkgFlags=[ SYSTEM HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP KILL_AFTER_RESTORE RESTORE_ANY_VERSION LARGE_HEAP ] | ||
| - | declared permissions: | ||
| - | com.google.android.youtube.permission.C2D_MESSAGE: | ||
| - | install permissions: | ||
| - | com.google.android.c2dm.permission.RECEIVE: | ||
| - | android.permission.USE_CREDENTIALS: | ||
| - | com.google.android.providers.gsf.permission.READ_GSERVICES: | ||
| - | com.google.android.youtube.permission.C2D_MESSAGE: | ||
| - | android.permission.MANAGE_ACCOUNTS: | ||
| - | android.permission.SYSTEM_ALERT_WINDOW: | ||
| - | android.permission.NFC: | ||
| - | android.permission.RECEIVE_BOOT_COMPLETED: | ||
| - | com.google.android.gms.permission.AD_ID_NOTIFICATION: | ||
| - | android.permission.INTERNET: | ||
| - | android.permission.GET_PACKAGE_SIZE: | ||
| - | android.permission.ACCESS_NETWORK_STATE: | ||
| - | android.permission.VIBRATE: | ||
| - | android.permission.ACCESS_WIFI_STATE: | ||
| - | android.permission.WAKE_LOCK: | ||
| - | User 0: ceDataInode=1139683 installed=true hidden=false suspended=false stopped=false notLaunched=false enabled=3 | ||
| - | lastDisabledCaller: | ||
| - | gids=[3003] | ||
| - | </ | ||
| - | |||
| - | ==== Supprimer une application ==== | ||
| - | Commençons par supprimer **chrome** : | ||
| - | <code bash> | ||
| - | bardock:/ $ pm list packages | grep chrome | ||
| - | package: | ||
| - | </ | ||
| - | |||
| - | On va utiliser la commande [[pm]] : | ||
| - | <code bash> | ||
| - | 127|bardock:/ | ||
| - | Error: unknown command ' | ||
| - | usage: pm path [--user USER_ID] PACKAGE | ||
| - | pm dump PACKAGE | ||
| - | pm install [-lrtsfd] [-i PACKAGE] [--user USER_ID] [PATH] | ||
| - | pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES] | ||
| - | | ||
| - | | ||
| - | pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH] | ||
| - | pm install-commit SESSION_ID | ||
| - | pm install-abandon SESSION_ID | ||
| - | pm uninstall [-k] [--user USER_ID] PACKAGE | ||
| - | pm set-installer PACKAGE INSTALLER | ||
| - | pm move-package PACKAGE [internal|UUID] | ||
| - | pm move-primary-storage [internal|UUID] | ||
| - | pm clear [--user USER_ID] PACKAGE | ||
| - | pm enable [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm disable [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm default-state [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm hide [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT | ||
| - | pm grant [--user USER_ID] PACKAGE PERMISSION | ||
| - | pm revoke [--user USER_ID] PACKAGE PERMISSION | ||
| - | pm reset-permissions | ||
| - | pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined} | ||
| - | pm get-app-link [--user USER_ID] PACKAGE | ||
| - | pm set-install-location [0/auto] [1/ | ||
| - | pm get-install-location | ||
| - | pm set-permission-enforced PERMISSION [true|false] | ||
| - | pm trim-caches DESIRED_FREE_SPACE [internal|UUID] | ||
| - | pm create-user [--profileOf USER_ID] [--managed] [--restricted] [--ephemeral] [--guest] USER_NAME | ||
| - | pm remove-user USER_ID | ||
| - | pm get-max-users | ||
| - | |||
| - | NOTE: 'pm list' commands have moved! Run 'adb shell cmd package' | ||
| - | to display the new commands. | ||
| - | |||
| - | pm path: print the path to the .apk of the given PACKAGE. | ||
| - | |||
| - | pm dump: print system state associated with the given PACKAGE. | ||
| - | |||
| - | pm install: install a single legacy package | ||
| - | pm install-create: | ||
| - | -l: forward lock application | ||
| - | -r: replace existing application | ||
| - | -t: allow test packages | ||
| - | -i: specify the installer package name | ||
| - | -s: install application on sdcard | ||
| - | -f: install application on internal flash | ||
| - | -d: allow version code downgrade (debuggable packages only) | ||
| - | -p: partial application install | ||
| - | -g: grant all runtime permissions | ||
| - | -S: size in bytes of entire session | ||
| - | |||
| - | pm install-write: | ||
| - | be ' | ||
| - | -S: size in bytes of package, required for stdin | ||
| - | |||
| - | pm install-commit: | ||
| - | pm install-abandon: | ||
| - | |||
| - | pm set-installer: | ||
| - | |||
| - | pm uninstall: removes a package from the system. Options: | ||
| - | -k: keep the data and cache directories around after package removal. | ||
| - | |||
| - | pm clear: deletes all data associated with a package. | ||
| - | |||
| - | pm enable, disable, disable-user, | ||
| - | these commands change the enabled state of a given package or | ||
| - | component (written as " | ||
| - | |||
| - | pm grant, revoke: these commands either grant or revoke permissions | ||
| - | to apps. The permissions must be declared as used in the app's | ||
| - | manifest, be runtime permissions (protection level dangerous), | ||
| - | and the app targeting SDK greater than Lollipop MR1. | ||
| - | |||
| - | pm reset-permissions: | ||
| - | |||
| - | pm get-install-location: | ||
| - | 0 [auto]: Let system decide the best location | ||
| - | 1 [internal]: Install on internal device storage | ||
| - | 2 [external]: Install on external media | ||
| - | |||
| - | pm set-install-location: | ||
| - | NOTE: this is only intended for debugging; using this can cause | ||
| - | applications to break and other undersireable behavior. | ||
| - | 0 [auto]: Let system decide the best location | ||
| - | 1 [internal]: Install on internal device storage | ||
| - | 2 [external]: Install on external media | ||
| - | |||
| - | pm trim-caches: | ||
| - | |||
| - | pm create-user: | ||
| - | printing the new user identifier of the user. | ||
| - | |||
| - | pm remove-user: | ||
| - | deleting all data associated with that user | ||
| - | </ | ||
| - | |||
| - | L' | ||
| - | <code bash> | ||
| - | bardock:/ $ pm uninstall com.android.chrome | ||
| - | Failure [DELETE_FAILED_INTERNAL_ERROR] | ||
| - | bardock:/ $ pm uninstall --user 0 com.android.chrome | ||
| - | Success | ||
| - | </ | ||
| - | |||
| - | Après avoir désinstallé Chrome, j' | ||
| - | Hop, on vire " | ||
| - | <code bash> | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.music | ||
| - | Success | ||
| - | </ | ||
| - | |||
| - | Le plus compliqué reste de trouver le nom du package à supprimer. On peut chercher avec [[dumpsys]], | ||
| - | <code bash> | ||
| - | $ dumpsys | grep -A 50 " | ||
| - | (...) | ||
| - | versionName=4.1.6.13 | ||
| - | </ | ||
| - | |||
| - | On peut alors comparer dans le menu et vérifier que la version correspond. | ||
| - | |||
| - | * L' | ||
| - | * L' | ||
| - | * Chrome : com.android.chrome | ||
| - | * Clavier Google : | ||
| - | * Contacts : | ||
| - | * Drive : | ||
| - | * Duo : | ||
| - | * Gmail : com.google.android.gm | ||
| - | * Google Play Musique : com.google.android.music | ||
| - | * Google Play Films et séries : com.google.android.videos | ||
| - | * Google (le widget) : com.google.android.googlequicksearchbox | ||
| - | * Hangouts : com.google.android.talk | ||
| - | * Magnétophone : **?** | ||
| - | * Maps : com.google.android.apps.maps | ||
| - | * Messages : com.google.android.apps.messaging | ||
| - | * Photos : com.google.android.apps.photos | ||
| - | * YouTube : com.google.android.youtube | ||
| - | |||
| - | <code bash> | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.apps.maps | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.apps.photos | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.music | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.android.providers.calendar | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.googlequicksearchbox | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.talk | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.apps.messaging | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.videos | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.youtube | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.gm | ||
| - | Success | ||
| - | bardock:/ $ pm uninstall --user 0 com.google.android.calendar | ||
| - | Success | ||
| - | </ | ||
adb.1532351529.txt.gz · Dernière modification : (modification externe)
