FileDocCategorySizeDatePackage
WindowId.javaAPI DocAndroid 5.1 API7301Thu Mar 12 22:22:10 GMT 2015android.view

WindowId

public class WindowId extends Object implements android.os.Parcelable
Safe identifier for a window. This currently allows you to retrieve and observe the input focus state of the window. Most applications will not use this, instead relying on the simpler (and more efficient) methods available on {@link View}. This classes is useful when window input interactions need to be done across processes: the class itself is a Parcelable that can be passed to other processes for them to interact with your window, and it provides a limited safe API that doesn't allow the other process to negatively harm your window.

Fields Summary
private final IWindowId
mToken
public static final Parcelable.Creator
CREATOR
Constructors Summary
public WindowId(IWindowId target)

hide

        mToken = target;
    
public WindowId(android.os.IBinder target)

hide

        mToken = IWindowId.Stub.asInterface(target);
    
Methods Summary
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object otherObj)
Comparison operator on two IntentSender objects, such that true is returned then they both represent the same operation from the same package.

        if (otherObj instanceof WindowId) {
            return mToken.asBinder().equals(((WindowId) otherObj)
                    .mToken.asBinder());
        }
        return false;
    
public IWindowIdgetTarget()

hide


      
       
        return mToken;
    
public inthashCode()

        return mToken.asBinder().hashCode();
    
public booleanisFocused()
Retrieve the current focus state of the associated window.

        try {
            return mToken.isFocused();
        } catch (RemoteException e) {
            return false;
        }
    
public voidregisterFocusObserver(android.view.WindowId$FocusObserver observer)
Start monitoring for changes in the focus state of the window.

        synchronized (observer.mRegistrations) {
            if (observer.mRegistrations.containsKey(mToken.asBinder())) {
                throw new IllegalStateException(
                        "Focus observer already registered with input token");
            }
            observer.mRegistrations.put(mToken.asBinder(), this);
            try {
                mToken.registerFocusObserver(observer.mIObserver);
            } catch (RemoteException e) {
            }
        }
    
public java.lang.StringtoString()

        StringBuilder sb = new StringBuilder(128);
        sb.append("IntentSender{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(": ");
        sb.append(mToken != null ? mToken.asBinder() : null);
        sb.append('}");
        return sb.toString();
    
public voidunregisterFocusObserver(android.view.WindowId$FocusObserver observer)
Stop monitoring changes in the focus state of the window.

        synchronized (observer.mRegistrations) {
            if (observer.mRegistrations.remove(mToken.asBinder()) == null) {
                throw new IllegalStateException("Focus observer not registered with input token");
            }
            try {
                mToken.unregisterFocusObserver(observer.mIObserver);
            } catch (RemoteException e) {
            }
        }
    
public voidwriteToParcel(android.os.Parcel out, int flags)

        out.writeStrongBinder(mToken.asBinder());