1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.autofillservice.cts.testcore; 17 18 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; 19 20 import android.autofillservice.cts.R; 21 import android.service.autofill.CustomDescription; 22 import android.widget.RemoteViews; 23 24 public final class CustomDescriptionHelper { 25 26 public static final String ID_SHOW = "show"; 27 public static final String ID_HIDE = "hide"; 28 public static final String ID_USERNAME_PLAIN = "username_plain"; 29 public static final String ID_USERNAME_MASKED = "username_masked"; 30 public static final String ID_PASSWORD_PLAIN = "password_plain"; 31 public static final String ID_PASSWORD_MASKED = "password_masked"; 32 33 private static final String sPackageName = 34 getInstrumentation().getTargetContext().getPackageName(); 35 36 newCustomDescriptionWithUsernameAndPassword()37 public static CustomDescription.Builder newCustomDescriptionWithUsernameAndPassword() { 38 return new CustomDescription.Builder(new RemoteViews(sPackageName, 39 R.layout.custom_description_with_username_and_password)); 40 } 41 newCustomDescriptionWithHiddenFields()42 public static CustomDescription.Builder newCustomDescriptionWithHiddenFields() { 43 return new CustomDescription.Builder(new RemoteViews(sPackageName, 44 R.layout.custom_description_with_hidden_fields)); 45 } 46 CustomDescriptionHelper()47 private CustomDescriptionHelper() { 48 throw new UnsupportedOperationException("contain static methods only"); 49 } 50 } 51