Methods Summary |
---|
protected void | finalize()
try {
stopObserving();
} finally {
super.finalize();
}
|
private static android.os.UEventObserver$UEventThread | getThread()
synchronized (UEventObserver.class) {
if (sThread == null) {
sThread = new UEventThread();
sThread.start();
}
return sThread;
}
|
private static native void | nativeAddMatch(java.lang.String match)
|
private static native void | nativeRemoveMatch(java.lang.String match)
|
private static native void | nativeSetup()
|
private static native java.lang.String | nativeWaitForNextEvent()
|
public abstract void | onUEvent(android.os.UEventObserver$UEvent event)Subclasses of UEventObserver should override this method to handle
UEvents.
|
private static android.os.UEventObserver$UEventThread | peekThread()
synchronized (UEventObserver.class) {
return sThread;
}
|
public final void | startObserving(java.lang.String match)Begin observation of UEvent's.
This method will cause the UEvent thread to start if this is the first
invocation of startObserving in this process.
Once called, the UEvent thread will call onUEvent() when an incoming
UEvent matches the specified string.
This method can be called multiple times to register multiple matches.
Only one call to stopObserving is required even with multiple registered
matches.
if (match == null || match.isEmpty()) {
throw new IllegalArgumentException("match substring must be non-empty");
}
final UEventThread t = getThread();
t.addObserver(match, this);
|
public final void | stopObserving()End observation of UEvent's.
This process's UEvent thread will never call onUEvent() on this
UEventObserver after this call. Repeated calls have no effect.
final UEventThread t = getThread();
if (t != null) {
t.removeObserver(this);
}
|