Build 1.0_r1(from source)

android.os
Class UEventObserver

java.lang.Object
  extended by android.os.UEventObserver

public abstract class UEventObserver
extends Object

UEventObserver is an abstract class that receives UEvent's from the kernel.

Subclass UEventObserver, implementing onUEvent(UEvent event), then call startObserving() with a match string. The UEvent thread will then call your onUEvent() method when a UEvent occurs that contains your match string.

Call stopObserving() to stop receiving UEvent's.

There is only one UEvent thread per process, even if that process has multiple UEventObserver subclass instances. The UEvent thread starts when the startObserving() is called for the first time in that process. Once started the UEvent thread will not stop (although it can stop notifying UEventObserver's via stopObserving()).


Nested Class Summary
static class UEventObserver.UEvent
          Representation of a UEvent.
 
Constructor Summary
UEventObserver()
           
 
Method Summary
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
abstract  void onUEvent(UEventObserver.UEvent event)
          Subclasses of UEventObserver should override this method to handle UEvents.
 void startObserving(String match)
          Begin observation of UEvent's.
 void stopObserving()
          End observation of UEvent's.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UEventObserver

public UEventObserver()
Method Detail

startObserving

public final void startObserving(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.

Parameters:
match - A substring of the UEvent to match. Use "" to match all UEvent's

stopObserving

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.


onUEvent

public abstract void onUEvent(UEventObserver.UEvent event)
Subclasses of UEventObserver should override this method to handle UEvents.


finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class Object
Throws:
Throwable - The virtual machine ignores any exceptions which are thrown during finalization.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature