[starvation] add models for checkPermission/checkSelfPermission

Summary:
Context.checkPermission makes IPC calls, and checkSelfPermission is implemented by calling the former.
https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/ContextImpl.java

Reviewed By: da319

Differential Revision: D27426353

fbshipit-source-id: 1791a5ead
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent a7bb4bd320
commit 7b0d47217c

@ -152,7 +152,10 @@ let may_do_ipc =
; methods= ["getActiveNetworkInfo"] } ; methods= ["getActiveNetworkInfo"] }
; { default with ; { default with
classname= "android.media.AudioManager" classname= "android.media.AudioManager"
; methods= ["getStreamVolume"; "getRingerMode"] } ]) ; methods= ["getStreamVolume"; "getRingerMode"] }
; { default with
classname= "android.content.Context"
; methods= ["checkPermission"; "checkSelfPermission"] } ])
let is_monitor_wait = let is_monitor_wait =

@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.os.Binder; import android.os.Binder;
@ -74,4 +75,14 @@ class Binders {
int doGetRingerModeBad(AudioManager a) { int doGetRingerModeBad(AudioManager a) {
return a.getRingerMode(); return a.getRingerMode();
} }
@UiThread
int doCheckPermissionBad(Context c) {
return c.checkPermission("", 0, 0);
}
@UiThread
int doCheckSelfPermissionBad(Context c) {
return c.checkSelfPermission("");
}
} }

@ -1,11 +1,13 @@
codetoanalyze/java/starvation/AsyncTaskGet.java, AsyncTaskGet.lockOnUiThreadBad():void, 31, STARVATION, no_bucket, ERROR, [[Trace 1] `void AsyncTaskGet.lockOnUiThreadBad()`, locks `this.lock` in `class AsyncTaskGet`,[Trace 2] `void AsyncTaskGet.taskGetUnderLock()`, locks `this.lock` in `class AsyncTaskGet`,calls `Object AsyncTask.get()`] codetoanalyze/java/starvation/AsyncTaskGet.java, AsyncTaskGet.lockOnUiThreadBad():void, 31, STARVATION, no_bucket, ERROR, [[Trace 1] `void AsyncTaskGet.lockOnUiThreadBad()`, locks `this.lock` in `class AsyncTaskGet`,[Trace 2] `void AsyncTaskGet.taskGetUnderLock()`, locks `this.lock` in `class AsyncTaskGet`,calls `Object AsyncTask.get()`]
codetoanalyze/java/starvation/AsyncTaskGet.java, AsyncTaskGet.taskGetOnUiThreadBad():void, 20, STARVATION, no_bucket, ERROR, [`void AsyncTaskGet.taskGetOnUiThreadBad()`,calls `Object AsyncTask.get()`] codetoanalyze/java/starvation/AsyncTaskGet.java, AsyncTaskGet.taskGetOnUiThreadBad():void, 20, STARVATION, no_bucket, ERROR, [`void AsyncTaskGet.taskGetOnUiThreadBad()`,calls `Object AsyncTask.get()`]
codetoanalyze/java/starvation/Binders.java, Binders.annotationBad():void, 43, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.annotationBad()`,Method call: `void Binders.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`] codetoanalyze/java/starvation/Binders.java, Binders.annotationBad():void, 44, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.annotationBad()`,Method call: `void Binders.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`]
codetoanalyze/java/starvation/Binders.java, Binders.doGetRingerModeBad(android.media.AudioManager):int, 75, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doGetRingerModeBad(AudioManager)`,calls `int AudioManager.getRingerMode()`] codetoanalyze/java/starvation/Binders.java, Binders.doCheckPermissionBad(android.content.Context):int, 81, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doCheckPermissionBad(Context)`,calls `int Context.checkPermission(String,int,int)`]
codetoanalyze/java/starvation/Binders.java, Binders.doGetStreamVolumeBad(android.media.AudioManager):int, 70, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doGetStreamVolumeBad(AudioManager)`,calls `int AudioManager.getStreamVolume(int)`] codetoanalyze/java/starvation/Binders.java, Binders.doCheckSelfPermissionBad(android.content.Context):int, 86, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doCheckSelfPermissionBad(Context)`,calls `int Context.checkSelfPermission(String)`]
codetoanalyze/java/starvation/Binders.java, Binders.getActiveNetworkInfoBad(android.net.ConnectivityManager):void, 65, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.getActiveNetworkInfoBad(ConnectivityManager)`,calls `NetworkInfo ConnectivityManager.getActiveNetworkInfo()`] codetoanalyze/java/starvation/Binders.java, Binders.doGetRingerModeBad(android.media.AudioManager):int, 76, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doGetRingerModeBad(AudioManager)`,calls `int AudioManager.getRingerMode()`]
codetoanalyze/java/starvation/Binders.java, Binders.interBad():void, 33, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.interBad()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`] codetoanalyze/java/starvation/Binders.java, Binders.doGetStreamVolumeBad(android.media.AudioManager):int, 71, IPC_ON_UI_THREAD, no_bucket, WARNING, [`int Binders.doGetStreamVolumeBad(AudioManager)`,calls `int AudioManager.getStreamVolume(int)`]
codetoanalyze/java/starvation/Binders.java, Binders.intraBad():void, 38, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.intraBad()`,Method call: `void Binders.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`] codetoanalyze/java/starvation/Binders.java, Binders.getActiveNetworkInfoBad(android.net.ConnectivityManager):void, 66, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.getActiveNetworkInfoBad(ConnectivityManager)`,calls `NetworkInfo ConnectivityManager.getActiveNetworkInfo()`]
codetoanalyze/java/starvation/Binders.java, Binders.interBad():void, 34, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.interBad()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`]
codetoanalyze/java/starvation/Binders.java, Binders.intraBad():void, 39, IPC_ON_UI_THREAD, no_bucket, WARNING, [`void Binders.intraBad()`,Method call: `void Binders.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`]
codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByAnnotBad():void, 21, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByAnnotBad()`,calls `void CountDownLatch.await()`] codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByAnnotBad():void, 21, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByAnnotBad()`,calls `void CountDownLatch.await()`]
codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByCallBad():void, 16, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByCallBad()`,calls `void CountDownLatch.await()`] codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByCallBad():void, 16, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByCallBad()`,calls `void CountDownLatch.await()`]
codetoanalyze/java/starvation/FutureGet.java, FutureGet.getDirectBad():void, 21, STARVATION, no_bucket, ERROR, [`void FutureGet.getDirectBad()`,calls `Object Future.get()`] codetoanalyze/java/starvation/FutureGet.java, FutureGet.getDirectBad():void, 21, STARVATION, no_bucket, ERROR, [`void FutureGet.getDirectBad()`,calls `Object Future.get()`]

Loading…
Cancel
Save