1 /* 2 * Copyright (C) 2020 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 com.android.settingslib; 17 18 import androidx.annotation.DrawableRes; 19 import androidx.annotation.StringRes; 20 21 /** 22 * Icons for SysUI and Settings. 23 */ 24 public class SignalIcon { 25 26 /** 27 * Holds icons for a given state. Arrays are generally indexed as inet 28 * state (full connectivity or not) first, and second dimension as 29 * signal strength. 30 */ 31 public static class IconGroup { 32 public final int[][] sbIcons; 33 public final int[][] qsIcons; 34 public final int[] contentDesc; 35 public final int sbNullState; 36 public final int qsNullState; 37 public final int sbDiscState; 38 public final int qsDiscState; 39 public final int discContentDesc; 40 // For logging. 41 public final String name; 42 IconGroup( String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc )43 public IconGroup( 44 String name, 45 int[][] sbIcons, 46 int[][] qsIcons, 47 int[] contentDesc, 48 int sbNullState, 49 int qsNullState, 50 int sbDiscState, 51 int qsDiscState, 52 int discContentDesc 53 ) { 54 this.name = name; 55 this.sbIcons = sbIcons; 56 this.qsIcons = qsIcons; 57 this.contentDesc = contentDesc; 58 this.sbNullState = sbNullState; 59 this.qsNullState = qsNullState; 60 this.sbDiscState = sbDiscState; 61 this.qsDiscState = qsDiscState; 62 this.discContentDesc = discContentDesc; 63 } 64 65 @Override toString()66 public String toString() { 67 return "IconGroup(" + name + ")"; 68 } 69 } 70 71 /** 72 * Holds RAT icons for a given MobileState. 73 */ 74 public static class MobileIconGroup extends IconGroup { 75 @StringRes public final int dataContentDescription; 76 @DrawableRes public final int dataType; 77 MobileIconGroup( String name, int dataContentDesc, int dataType )78 public MobileIconGroup( 79 String name, 80 int dataContentDesc, 81 int dataType 82 ) { 83 super(name, 84 // The rest of the values are the same for every type of MobileIconGroup, so 85 // just provide them here. 86 // TODO(b/238425913): Eventually replace with {@link MobileNetworkTypeIcon} so 87 // that we don't have to fill in these superfluous fields. 88 /* sbIcons= */ null, 89 /* qsIcons= */ null, 90 /* contentDesc= */ AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH, 91 /* sbNullState= */ 0, 92 /* qsNullState= */ 0, 93 /* sbDiscState= */ 0, 94 /* qsDiscState= */ 0, 95 /* discContentDesc= */ 96 AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH_NONE); 97 this.dataContentDescription = dataContentDesc; 98 this.dataType = dataType; 99 } 100 } 101 } 102