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

Commit 0903351f authored by Jack Yu's avatar Jack Yu
Browse files

nfc(api): nfc charging api

Add NFC charging APIs.

Bug: 292143899
Test: compiles
Change-Id: I12e46bf33dee45b1ea78c331dd783399eec5f7d5
parent 589cf5ff
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -12932,6 +12932,7 @@ package android.content.pm {
    field public static final String FEATURE_MIDI = "android.software.midi";
    field public static final String FEATURE_NFC = "android.hardware.nfc";
    field public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam";
    field @FlaggedApi("android.nfc.enable_nfc_charging") public static final String FEATURE_NFC_CHARGING = "android.hardware.nfc.charging";
    field public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
    field public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
    field public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
@@ -28813,6 +28814,7 @@ package android.nfc {
    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
    method @Nullable public android.nfc.NfcAntennaInfo getNfcAntennaInfo();
    method @FlaggedApi("android.nfc.enable_nfc_charging") @Nullable public android.nfc.WlcLDeviceInfo getWlcLDeviceInfo();
    method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler);
    method public boolean isEnabled();
    method @FlaggedApi("android.nfc.nfc_observe_mode") public boolean isObserveModeSupported();
@@ -28820,6 +28822,7 @@ package android.nfc {
    method @FlaggedApi("android.nfc.enable_nfc_reader_option") public boolean isReaderOptionSupported();
    method public boolean isSecureNfcEnabled();
    method public boolean isSecureNfcSupported();
    method @FlaggedApi("android.nfc.enable_nfc_charging") public boolean isWlcEnabled();
    field public static final String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
    field public static final String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED";
    field @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static final String ACTION_PREFERRED_PAYMENT_CHANGED = "android.nfc.action.PREFERRED_PAYMENT_CHANGED";
@@ -28905,6 +28908,20 @@ package android.nfc {
    ctor public TagLostException(String);
  }
  @FlaggedApi("android.nfc.enable_nfc_charging") public final class WlcLDeviceInfo implements android.os.Parcelable {
    ctor public WlcLDeviceInfo(double, double, double, int);
    method public int describeContents();
    method public double getBatteryLevel();
    method public double getProductId();
    method public int getState();
    method public double getTemperature();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int CONNECTED_CHARGING = 2; // 0x2
    field public static final int CONNECTED_DISCHARGING = 3; // 0x3
    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.WlcLDeviceInfo> CREATOR;
    field public static final int DISCONNECTED = 1; // 0x1
  }
}
package android.nfc.cardemulation {
+7 −0
Original line number Diff line number Diff line
@@ -9884,17 +9884,20 @@ package android.nfc {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable();
    method @FlaggedApi("android.nfc.enable_nfc_reader_option") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableReaderOption(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean);
    method @FlaggedApi("android.nfc.enable_nfc_charging") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableWlc(boolean);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") public int getAdapterState();
    method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public java.util.Map<java.lang.String,java.lang.Boolean> getTagIntentAppPreferenceForUser(int);
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOn();
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOnSupported();
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isTagIntentAppPreferenceSupported();
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public void registerControllerAlwaysOnListener(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcAdapter.ControllerAlwaysOnListener);
    method @FlaggedApi("android.nfc.enable_nfc_charging") public void registerWlcStateListener(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcAdapter.WlcStateListener);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler);
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean setControllerAlwaysOn(boolean);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setReaderMode(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int setTagIntentAppPreferenceForUser(int, @NonNull String, boolean);
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public void unregisterControllerAlwaysOnListener(@NonNull android.nfc.NfcAdapter.ControllerAlwaysOnListener);
    method @FlaggedApi("android.nfc.enable_nfc_charging") public void unregisterWlcStateListener(@NonNull android.nfc.NfcAdapter.WlcStateListener);
    field @FlaggedApi("android.nfc.enable_nfc_mainline") public static final String ACTION_REQUIRE_UNLOCK_FOR_NFC = "android.nfc.action.REQUIRE_UNLOCK_FOR_NFC";
    field public static final int TAG_INTENT_APP_PREF_RESULT_PACKAGE_NOT_FOUND = -1; // 0xffffffff
    field public static final int TAG_INTENT_APP_PREF_RESULT_SUCCESS = 0; // 0x0
@@ -9909,6 +9912,10 @@ package android.nfc {
    method public boolean onUnlockAttempted(android.nfc.Tag);
  }
  @FlaggedApi("android.nfc.enable_nfc_charging") public static interface NfcAdapter.WlcStateListener {
    method public void onWlcStateChanged(@NonNull android.nfc.WlcLDeviceInfo);
  }
}
package android.nfc.cardemulation {
+9 −1
Original line number Diff line number Diff line
@@ -3293,6 +3293,14 @@ public abstract class PackageManager {
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports NFC charging.
     */
    @SdkConstant(SdkConstantType.FEATURE)
    @FlaggedApi(android.nfc.Flags.FLAG_ENABLE_NFC_CHARGING)
    public static final String FEATURE_NFC_CHARGING = "android.hardware.nfc.charging";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The Beam API is enabled on the device.
@@ -3304,7 +3312,7 @@ public abstract class PackageManager {
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports any
     * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
     * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
     * {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF}, or {@link #FEATURE_NFC_CHARGING} features.
     *
     * @hide
     */
+9 −0
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ import android.nfc.INfcFCardEmulation;
import android.nfc.INfcUnlockHandler;
import android.nfc.ITagRemovedCallback;
import android.nfc.INfcDta;
import android.nfc.INfcWlcStateListener;
import android.nfc.NfcAntennaInfo;
import android.os.Bundle;
import android.nfc.WlcLDeviceInfo;

/**
 * @hide
@@ -86,4 +88,11 @@ interface INfcAdapter
    boolean enableReaderOption(boolean enable);
    boolean isObserveModeSupported();
    boolean setObserveMode(boolean enabled);

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
    boolean enableWlc(boolean enable);
    boolean isWlcEnabled();
    void registerWlcStateListener(in INfcWlcStateListener listener);
    void unregisterWlcStateListener(in INfcWlcStateListener listener);
    WlcLDeviceInfo getWlcLDeviceInfo();
}
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.nfc;

import android.nfc.WlcLDeviceInfo;
/**
 * @hide
 */
oneway interface INfcWlcStateListener {
  /**
   * Called whenever NFC WLC state changes
   *
   * @param wlcLDeviceInfo NFC wlc listener information
   */
  void onWlcStateChanged(in WlcLDeviceInfo wlcLDeviceInfo);
}
Loading