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

Commit bd8a2af0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[nfc] Support dynamically updating screen state attributes" into main

parents 36b873f4 864f66a3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11002,6 +11002,8 @@ package android.nfc.cardemulation {
    method @FlaggedApi("android.nfc.enable_nfc_mainline") public void setCategoryOtherServiceEnabled(boolean);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") public void setDynamicAidGroup(@NonNull android.nfc.cardemulation.AidGroup);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") public void setOffHostSecureElement(@NonNull String);
    method @FlaggedApi("android.nfc.screen_state_attribute_toggle") public void setRequiresScreenOn(boolean);
    method @FlaggedApi("android.nfc.screen_state_attribute_toggle") public void setRequiresUnlock(boolean);
    method public void setShouldDefaultToObserveMode(boolean);
    method public boolean shouldDefaultToObserveMode();
    method @FlaggedApi("android.nfc.nfc_associated_role_services") public boolean wantsRoleHolderPriority();
+8 −0
Original line number Diff line number Diff line
@@ -198,6 +198,14 @@ flag {
    bug: "380892385"
}

flag {
    name: "screen_state_attribute_toggle"
    is_exported: true
    namespace: "nfc"
    description: "API to toggle requireDeviceUnlock and requireDeviceScreenOn attributes for HCE service."
    bug: "417742419"
}

# Unless you are adding a flag for a file under nfc-non-updatable, you should
# not add a flag here for Android 16+ targeting features. Use the flags
# in com.android.nfc.module.flags (packages/modules/Nfc/flags) instead.
+22 −2
Original line number Diff line number Diff line
@@ -143,12 +143,12 @@ public final class ApduServiceInfo implements Parcelable {
    /**
     * Whether this service should only be started when the device is unlocked.
     */
    private final boolean mRequiresDeviceUnlock;
    private boolean mRequiresDeviceUnlock;

    /**
     * Whether this service should only be started when the device is screen on.
     */
    private final boolean mRequiresDeviceScreenOn;
    private boolean mRequiresDeviceScreenOn;

    /**
     * The id of the service banner specified in XML.
@@ -747,6 +747,16 @@ public final class ApduServiceInfo implements Parcelable {
        return mRequiresDeviceUnlock;
    }

    /**
     * Sets whether this service should only be activated when the device is unlocked.
     * @param requiresUnlock True if the service should only be activated when the device is
     *                       unlocked, false otherwise.
     */
    @FlaggedApi(Flags.FLAG_SCREEN_STATE_ATTRIBUTE_TOGGLE)
    public void setRequiresUnlock(boolean requiresUnlock) {
        mRequiresDeviceUnlock = requiresUnlock;
    }

    /**
     * Returns whether this service should only be started when the device is screen on.
     * @return whether the service requires screen on
@@ -756,6 +766,16 @@ public final class ApduServiceInfo implements Parcelable {
        return mRequiresDeviceScreenOn;
    }

    /**
     * Sets whether this service should only be activated when the device's screen is on.
     * @param requiresScreenOn True if the service should only be activated when the device's screen
     *                         is on, false otherwise
     */
    @FlaggedApi(Flags.FLAG_SCREEN_STATE_ATTRIBUTE_TOGGLE)
    public void setRequiresScreenOn(boolean requiresScreenOn) {
        mRequiresDeviceScreenOn = requiresScreenOn;
    }

    /**
     * Returns whether the NFC stack should default to observe mode when this service is preferred.
     * @return whether the NFC stack should default to observe mode when this service is preferred