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.
64 lines
1.1 KiB
64 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 PubPriv {
|
|
Binder b;
|
|
|
|
@UiThread
|
|
private void doTransactOk() throws RemoteException {
|
|
b.transact(0, null, null, 0);
|
|
}
|
|
|
|
public void transactBad() throws RemoteException {
|
|
doTransactOk();
|
|
}
|
|
|
|
public void alsoBad() throws RemoteException {
|
|
transactBad();
|
|
}
|
|
|
|
private void chainOK() throws RemoteException {
|
|
alsoBad();
|
|
}
|
|
|
|
Object lockA, lockB;
|
|
|
|
private void oneWayOk() {
|
|
synchronized (lockA) {
|
|
synchronized (lockB) {
|
|
}
|
|
}
|
|
}
|
|
|
|
private void anotherWayOk() {
|
|
synchronized (lockB) {
|
|
synchronized (lockA) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public void callOneWayBad() {
|
|
oneWayOk();
|
|
}
|
|
|
|
public void callAnotherWayBad() {
|
|
anotherWayOk();
|
|
}
|
|
|
|
private void callOneWayOk() {
|
|
oneWayOk();
|
|
}
|
|
|
|
private void callAnotherWayOk() {
|
|
anotherWayOk();
|
|
}
|
|
}
|