Files
app_Settings/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
joshmccloskey 6634c159fd Adding slice for Face Enrollment
Fixes: 134965754
Test: Verified slice appears when not enrolled.
Test: Verified slice does not appear when enrolled.
Test: Verified slice disappears after clicking on icon and going back
to settings page.
Change-Id: Id1c4458742ab622df8d5881e926fe54684b36843
2019-06-24 17:41:36 -07:00

94 lines
4.6 KiB
Java

/*
* Copyright (C) 2018 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 com.android.settings.homepage.contextualcards;
import android.annotation.Nullable;
import com.android.settings.intelligence.ContextualCardProto.ContextualCard;
import com.android.settings.intelligence.ContextualCardProto.ContextualCardList;
import com.android.settings.slices.CustomSliceRegistry;
import com.google.android.settings.intelligence.libs.contextualcards.ContextualCardProvider;
/** Provides dynamic card for SettingsIntelligence. */
public class SettingsContextualCardProvider extends ContextualCardProvider {
public static final String CARD_AUTHORITY = "com.android.settings.homepage.contextualcards";
@Override
@Nullable
public ContextualCardList getContextualCards() {
final ContextualCard wifiCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString())
.setCardName(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString())
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
final ContextualCard connectedDeviceCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI.toString())
.setCardName(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI.toString())
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
final ContextualCard lowStorageCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.LOW_STORAGE_SLICE_URI.toString())
.setCardName(CustomSliceRegistry.LOW_STORAGE_SLICE_URI.toString())
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
final ContextualCard batteryFixCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.BATTERY_FIX_SLICE_URI.toString())
.setCardName(CustomSliceRegistry.BATTERY_FIX_SLICE_URI.toString())
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
final String contextualNotificationChannelSliceUri =
CustomSliceRegistry.CONTEXTUAL_NOTIFICATION_CHANNEL_SLICE_URI.toString();
final ContextualCard notificationChannelCard =
ContextualCard.newBuilder()
.setSliceUri(contextualNotificationChannelSliceUri)
.setCardName(contextualNotificationChannelSliceUri)
.setCardCategory(ContextualCard.Category.POSSIBLE)
.build();
final String contextualAdaptiveSleepSliceUri =
CustomSliceRegistry.CONTEXTUAL_ADAPTIVE_SLEEP_URI.toString();
final ContextualCard contextualAdaptiveSleepCard =
ContextualCard.newBuilder()
.setSliceUri(contextualAdaptiveSleepSliceUri)
.setCardName(contextualAdaptiveSleepSliceUri)
.setCardCategory(ContextualCard.Category.DEFAULT)
.build();
final ContextualCard contextualFaceSettingsCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.FACE_ENROLL_SLICE_URI.toString())
.setCardName(CustomSliceRegistry.FACE_ENROLL_SLICE_URI.toString())
.setCardCategory(ContextualCard.Category.DEFAULT)
.build();
final ContextualCardList cards = ContextualCardList.newBuilder()
.addCard(wifiCard)
.addCard(connectedDeviceCard)
.addCard(lowStorageCard)
.addCard(batteryFixCard)
.addCard(notificationChannelCard)
.addCard(contextualAdaptiveSleepCard)
.addCard(contextualFaceSettingsCard)
.build();
return cards;
}
}