Add attr for nfc applications to configure support power states
Use requireDeviceUnlock and requireDeviceScreenOn to configure the power state for the AIDs of the nfc applications. Bug: 171460473 Test: build pass Change-Id: I03bd537082117e595a7badfb2d8ca6ee7cae08cf
This commit is contained in:
@@ -1149,6 +1149,7 @@ package android {
|
||||
field public static final int reqNavigation = 16843306; // 0x101022a
|
||||
field public static final int reqTouchScreen = 16843303; // 0x1010227
|
||||
field public static final int requestLegacyExternalStorage = 16844291; // 0x1010603
|
||||
field public static final int requireDeviceScreenOn = 16844315; // 0x101061b
|
||||
field public static final int requireDeviceUnlock = 16843756; // 0x10103ec
|
||||
field public static final int required = 16843406; // 0x101028e
|
||||
field public static final int requiredAccountType = 16843734; // 0x10103d6
|
||||
|
||||
@@ -97,6 +97,11 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
*/
|
||||
final boolean mRequiresDeviceUnlock;
|
||||
|
||||
/**
|
||||
* Whether this service should only be started when the device is screen on.
|
||||
*/
|
||||
final boolean mRequiresDeviceScreenOn;
|
||||
|
||||
/**
|
||||
* The id of the service banner specified in XML.
|
||||
*/
|
||||
@@ -120,6 +125,18 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
ArrayList<AidGroup> staticAidGroups, ArrayList<AidGroup> dynamicAidGroups,
|
||||
boolean requiresUnlock, int bannerResource, int uid,
|
||||
String settingsActivityName, String offHost, String staticOffHost) {
|
||||
this(info, onHost, description, staticAidGroups, dynamicAidGroups,
|
||||
requiresUnlock, onHost ? true : false, bannerResource, uid,
|
||||
settingsActivityName, offHost, staticOffHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public ApduServiceInfo(ResolveInfo info, boolean onHost, String description,
|
||||
ArrayList<AidGroup> staticAidGroups, ArrayList<AidGroup> dynamicAidGroups,
|
||||
boolean requiresUnlock, boolean requiresScreenOn, int bannerResource, int uid,
|
||||
String settingsActivityName, String offHost, String staticOffHost) {
|
||||
this.mService = info;
|
||||
this.mDescription = description;
|
||||
this.mStaticAidGroups = new HashMap<String, AidGroup>();
|
||||
@@ -128,6 +145,7 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
this.mStaticOffHostName = staticOffHost;
|
||||
this.mOnHost = onHost;
|
||||
this.mRequiresDeviceUnlock = requiresUnlock;
|
||||
this.mRequiresDeviceScreenOn = requiresScreenOn;
|
||||
for (AidGroup aidGroup : staticAidGroups) {
|
||||
this.mStaticAidGroups.put(aidGroup.category, aidGroup);
|
||||
}
|
||||
@@ -184,6 +202,9 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
mRequiresDeviceUnlock = sa.getBoolean(
|
||||
com.android.internal.R.styleable.HostApduService_requireDeviceUnlock,
|
||||
false);
|
||||
mRequiresDeviceScreenOn = sa.getBoolean(
|
||||
com.android.internal.R.styleable.HostApduService_requireDeviceScreenOn,
|
||||
true);
|
||||
mBannerResourceId = sa.getResourceId(
|
||||
com.android.internal.R.styleable.HostApduService_apduServiceBanner, -1);
|
||||
mSettingsActivityName = sa.getString(
|
||||
@@ -197,7 +218,12 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
mService = info;
|
||||
mDescription = sa.getString(
|
||||
com.android.internal.R.styleable.OffHostApduService_description);
|
||||
mRequiresDeviceUnlock = false;
|
||||
mRequiresDeviceUnlock = sa.getBoolean(
|
||||
com.android.internal.R.styleable.OffHostApduService_requireDeviceUnlock,
|
||||
false);
|
||||
mRequiresDeviceScreenOn = sa.getBoolean(
|
||||
com.android.internal.R.styleable.OffHostApduService_requireDeviceScreenOn,
|
||||
false);
|
||||
mBannerResourceId = sa.getResourceId(
|
||||
com.android.internal.R.styleable.OffHostApduService_apduServiceBanner, -1);
|
||||
mSettingsActivityName = sa.getString(
|
||||
@@ -420,6 +446,13 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
return mRequiresDeviceUnlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this service should only be started when the device is screen on.
|
||||
*/
|
||||
public boolean requiresScreenOn() {
|
||||
return mRequiresDeviceScreenOn;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public String getDescription() {
|
||||
return mDescription;
|
||||
@@ -543,6 +576,7 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
dest.writeTypedList(new ArrayList<AidGroup>(mDynamicAidGroups.values()));
|
||||
}
|
||||
dest.writeInt(mRequiresDeviceUnlock ? 1 : 0);
|
||||
dest.writeInt(mRequiresDeviceScreenOn ? 1 : 0);
|
||||
dest.writeInt(mBannerResourceId);
|
||||
dest.writeInt(mUid);
|
||||
dest.writeString(mSettingsActivityName);
|
||||
@@ -569,11 +603,12 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
source.readTypedList(dynamicAidGroups, AidGroup.CREATOR);
|
||||
}
|
||||
boolean requiresUnlock = source.readInt() != 0;
|
||||
boolean requiresScreenOn = source.readInt() != 0;
|
||||
int bannerResource = source.readInt();
|
||||
int uid = source.readInt();
|
||||
String settingsActivityName = source.readString();
|
||||
return new ApduServiceInfo(info, onHost, description, staticAidGroups,
|
||||
dynamicAidGroups, requiresUnlock, bannerResource, uid,
|
||||
dynamicAidGroups, requiresUnlock, requiresScreenOn, bannerResource, uid,
|
||||
settingsActivityName, offHostName, staticOffHostName);
|
||||
}
|
||||
|
||||
@@ -608,6 +643,8 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
}
|
||||
}
|
||||
pw.println(" Settings Activity: " + mSettingsActivityName);
|
||||
pw.println(" Requires Device Unlock: " + mRequiresDeviceUnlock);
|
||||
pw.println(" Requires Device ScreenOn: " + mRequiresDeviceScreenOn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3871,6 +3871,9 @@
|
||||
<!-- Component name of an activity that allows the user to modify
|
||||
the settings for this service. -->
|
||||
<attr name="settingsActivity"/>
|
||||
<!-- Whether the device must be screen on before routing data to this service.
|
||||
The default is true.-->
|
||||
<attr name="requireDeviceScreenOn" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Use <code>offhost-apdu-service</code> as the root tag of the XML resource that
|
||||
@@ -3889,6 +3892,12 @@
|
||||
<attr name="settingsActivity"/>
|
||||
<!-- Secure Element which the AIDs should be routed to -->
|
||||
<attr name="secureElementName" format="string"/>
|
||||
<!-- Whether the device must be unlocked before routing data to this service.
|
||||
The default is false.-->
|
||||
<attr name="requireDeviceUnlock"/>
|
||||
<!-- Whether the device must be screen on before routing data to this service.
|
||||
The default is false.-->
|
||||
<attr name="requireDeviceScreenOn"/>
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Specify one or more <code>aid-group</code> elements inside a
|
||||
|
||||
@@ -3049,6 +3049,7 @@
|
||||
<public name="windowLayoutAffinity" />
|
||||
<!-- @hide -->
|
||||
<public name="windowBackgroundBlurRadius"/>
|
||||
<public name="requireDeviceScreenOn" />
|
||||
</public-group>
|
||||
|
||||
<public-group type="drawable" first-id="0x010800b5">
|
||||
|
||||
Reference in New Issue
Block a user