You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import android.os.Binder;
|
|
import android.os.RemoteException;
|
|
import android.support.annotation.UiThread;
|
|
|
|
class Binders {
|
|
Binder b;
|
|
|
|
void doTransact() throws RemoteException {
|
|
b.transact(0, null, null, 0);
|
|
}
|
|
|
|
void doOneWayTransact() throws RemoteException {
|
|
b.transact(0, null, null, 1);
|
|
}
|
|
|
|
void interBad() throws RemoteException {
|
|
b.transact(0, null, null, 0);
|
|
forceMainThread();
|
|
}
|
|
|
|
void intraBad() throws RemoteException {
|
|
OurThreadUtils.assertMainThread();
|
|
doTransact();
|
|
}
|
|
|
|
@UiThread
|
|
void annotationBad() throws RemoteException {
|
|
doTransact();
|
|
}
|
|
|
|
void intraOk() throws RemoteException {
|
|
b.transact(0, null, null, 0);
|
|
}
|
|
|
|
void interOk() throws RemoteException {
|
|
doTransact();
|
|
}
|
|
|
|
void oneWayOk() throws RemoteException {
|
|
OurThreadUtils.assertMainThread();
|
|
doOneWayTransact();
|
|
}
|
|
|
|
void forceMainThread() {
|
|
OurThreadUtils.assertMainThread();
|
|
}
|
|
}
|