Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 626861c5 authored by Andres Morales's avatar Andres Morales Committed by Android (Google) Code Review
Browse files

Merge "Framework changes to support NFC trustlet."

parents 29307648 3b33fd28
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ LOCAL_SRC_FILES += \
	core/java/android/nfc/INfcAdapterExtras.aidl \
	core/java/android/nfc/INfcTag.aidl \
	core/java/android/nfc/INfcCardEmulation.aidl \
	core/java/android/nfc/INfcLockscreenDispatch.aidl \
	core/java/android/os/IBatteryPropertiesListener.aidl \
	core/java/android/os/IBatteryPropertiesRegistrar.aidl \
	core/java/android/os/ICancellationSignal.aidl \
+5 −0
Original line number Diff line number Diff line
@@ -17641,6 +17641,7 @@ package android.nfc {
    method public boolean invokeBeam(android.app.Activity);
    method public boolean isEnabled();
    method public boolean isNdefPushEnabled();
    method public boolean registerLockscreenDispatch(android.nfc.NfcAdapter.NfcLockscreenDispatch, int[]);
    method public void setBeamPushUris(android.net.Uri[], android.app.Activity);
    method public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity);
    method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...);
@@ -17676,6 +17677,10 @@ package android.nfc {
    method public abstract android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent);
  }
  public static abstract interface NfcAdapter.NfcLockscreenDispatch {
    method public abstract boolean onTagDetected(android.nfc.Tag);
  }
  public static abstract interface NfcAdapter.OnNdefPushCompleteCallback {
    method public abstract void onNdefPushComplete(android.nfc.NfcEvent);
  }
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.nfc.IAppCallback;
import android.nfc.INfcAdapterExtras;
import android.nfc.INfcTag;
import android.nfc.INfcCardEmulation;
import android.nfc.INfcLockscreenDispatch;
import android.os.Bundle;

/**
@@ -52,4 +53,6 @@ interface INfcAdapter

    void setReaderMode (IBinder b, IAppCallback callback, int flags, in Bundle extras);
    void setP2pModes(int initatorModes, int targetModes);

    void registerLockscreenDispatch(INfcLockscreenDispatch lockscreenDispatch, in int[] techList);
}
+12 −0
Original line number Diff line number Diff line
package android.nfc;

import android.nfc.Tag;

/**
 * @hide
 */
interface INfcLockscreenDispatch {

    boolean onTagDetected(in Tag tag);

}
+27 −0
Original line number Diff line number Diff line
@@ -380,6 +380,16 @@ public final class NfcAdapter {
        public Uri[] createBeamUris(NfcEvent event);
    }


    /**
     * A callback to be invoked when an application has registered for receiving
     * tags at the lockscreen.
     */
    public interface NfcLockscreenDispatch {
        public boolean onTagDetected(Tag tag);
    }


    /**
     * Helper to check if this device has FEATURE_NFC, but without using
     * a context.
@@ -1417,6 +1427,23 @@ public final class NfcAdapter {
        }
    }

    public boolean registerLockscreenDispatch(final NfcLockscreenDispatch lockscreenDispatch,
                                           int[] techList) {
        try {
            sService.registerLockscreenDispatch(new INfcLockscreenDispatch.Stub() {
                @Override
                public boolean onTagDetected(Tag tag) throws RemoteException {
                    return lockscreenDispatch.onTagDetected(tag);
                }
            }, techList);
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            return false;
        }

        return true;
    }

    /**
     * @hide
     */