Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/SystemUI/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
<string name="quick_settings_tiles_stock" translatable="false">
internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,powershare
internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,nfc,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,powershare
</string>

<!-- The tiles to display in QuickSettings -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public BooleanState newTileState() {
@Override
public void handleSetListening(boolean listening) {
super.handleSetListening(listening);
if (mListening == listening) return;
mListening = listening;
if (mListening) {
mBroadcastDispatcher.registerReceiver(mNfcReceiver,
Expand Down Expand Up @@ -159,11 +160,7 @@ public int getMetricsCategory() {

private NfcAdapter getAdapter() {
if (mAdapter == null) {
try {
mAdapter = NfcAdapter.getDefaultAdapter(mContext);
} catch (UnsupportedOperationException e) {
mAdapter = null;
}
mAdapter = NfcAdapter.getDefaultAdapter(mContext.getApplicationContext());
}
return mAdapter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ interface ConnectivityModule {
const val HOTSPOT_TILE_SPEC = "hotspot"
const val CAST_TILE_SPEC = "cast"
const val BLUETOOTH_TILE_SPEC = "bt"
const val NFC_TILE_SPEC = "nfc"

@Provides
@IntoMap
Expand Down Expand Up @@ -375,5 +376,20 @@ interface ConnectivityModule {
instanceId = uiEventLogger.getNewInstanceId(),
category = TileCategory.CONNECTIVITY,
)

@Provides
@IntoMap
@StringKey(NFC_TILE_SPEC)
fun provideNfcTileConfig(uiEventLogger: QsEventLogger): QSTileConfig =
QSTileConfig(
tileSpec = TileSpec.create(NFC_TILE_SPEC),
uiConfig =
QSTileUIConfig.Resource(
iconRes = R.drawable.ic_qs_nfc,
labelRes = R.string.quick_settings_nfc_label,
),
instanceId = uiEventLogger.getNewInstanceId(),
category = TileCategory.CONNECTIVITY,
)
}
}