Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +26 −3 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import android.text.TextUtils; import android.text.TextUtils; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.FloatProperty; import android.util.FloatProperty; import android.util.Log; import android.util.Log; import android.util.Property; import android.util.Property; Loading Loading @@ -73,7 +74,10 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi * want to scale them (in a way that doesn't require an asset dump) down 2dp. So * want to scale them (in a way that doesn't require an asset dump) down 2dp. So * 17dp * (15 / 17) = 15dp, the new height. * 17dp * (15 / 17) = 15dp, the new height. */ */ private static final float SYSTEM_ICON_SCALE = 15.f / 17.f; private static final float SYSTEM_ICON_DESIRED_HEIGHT = 15f; private static final float SYSTEM_ICON_INTRINSIC_HEIGHT = 17f; private static final float SYSTEM_ICON_SCALE = SYSTEM_ICON_DESIRED_HEIGHT / SYSTEM_ICON_INTRINSIC_HEIGHT; private final int ANIMATION_DURATION_FAST = 100; private final int ANIMATION_DURATION_FAST = 100; public static final int STATE_ICON = 0; public static final int STATE_ICON = 0; Loading Loading @@ -202,9 +206,26 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi updatePivot(); updatePivot(); } } // Makes sure that all icons are scaled to the same height (15dp). If we cannot get a height // for the icon, it uses the default SCALE (15f / 17f) which is the old behavior private void updateIconScaleForSystemIcons() { private void updateIconScaleForSystemIcons() { float iconHeight = getIconHeightInDps(); if (iconHeight != 0) { mIconScale = SYSTEM_ICON_DESIRED_HEIGHT / iconHeight; } else { mIconScale = SYSTEM_ICON_SCALE; mIconScale = SYSTEM_ICON_SCALE; } } } private float getIconHeightInDps() { Drawable d = getDrawable(); if (d != null) { return ((float) getDrawable().getIntrinsicHeight() * DisplayMetrics.DENSITY_DEFAULT) / mDensity; } else { return SYSTEM_ICON_INTRINSIC_HEIGHT; } } public float getIconScaleFullyDark() { public float getIconScaleFullyDark() { return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize; return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize; Loading @@ -221,8 +242,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi if (density != mDensity) { if (density != mDensity) { mDensity = density; mDensity = density; reloadDimens(); reloadDimens(); maybeUpdateIconScaleDimens(); updateDrawable(); updateDrawable(); maybeUpdateIconScaleDimens(); } } boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; == Configuration.UI_MODE_NIGHT_YES; Loading Loading @@ -305,6 +326,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi if (!updateDrawable(false /* no clear */)) return false; if (!updateDrawable(false /* no clear */)) return false; // we have to clear the grayscale tag since it may have changed // we have to clear the grayscale tag since it may have changed setTag(R.id.icon_is_grayscale, null); setTag(R.id.icon_is_grayscale, null); // Maybe set scale based on icon height maybeUpdateIconScaleDimens(); } } if (!levelEquals) { if (!levelEquals) { setImageLevel(icon.iconLevel); setImageLevel(icon.iconLevel); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class PhoneStatusBarPolicy private static final String TAG = "PhoneStatusBarPolicy"; private static final String TAG = "PhoneStatusBarPolicy"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); public static final int LOCATION_STATUS_ICON_ID = R.drawable.stat_sys_location; public static final int LOCATION_STATUS_ICON_ID = PrivacyType.TYPE_LOCATION.getIconId(); private final String mSlotCast; private final String mSlotCast; private final String mSlotHotspot; private final String mSlotHotspot; Loading Loading @@ -230,10 +230,10 @@ public class PhoneStatusBarPolicy mIconController.setIconVisibility(mSlotDataSaver, false); mIconController.setIconVisibility(mSlotDataSaver, false); // privacy items // privacy items mIconController.setIcon(mSlotMicrophone, R.drawable.stat_sys_mic_none, mIconController.setIcon(mSlotMicrophone, PrivacyType.TYPE_MICROPHONE.getIconId(), PrivacyType.TYPE_MICROPHONE.getName(mContext)); PrivacyType.TYPE_MICROPHONE.getName(mContext)); mIconController.setIconVisibility(mSlotMicrophone, false); mIconController.setIconVisibility(mSlotMicrophone, false); mIconController.setIcon(mSlotCamera, R.drawable.stat_sys_camera, mIconController.setIcon(mSlotCamera, PrivacyType.TYPE_CAMERA.getIconId(), PrivacyType.TYPE_CAMERA.getName(mContext)); PrivacyType.TYPE_CAMERA.getName(mContext)); mIconController.setIconVisibility(mSlotCamera, false); mIconController.setIconVisibility(mSlotCamera, false); mIconController.setIcon(mSlotLocation, LOCATION_STATUS_ICON_ID, mIconController.setIcon(mSlotLocation, LOCATION_STATUS_ICON_ID, Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +26 −3 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import android.text.TextUtils; import android.text.TextUtils; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.FloatProperty; import android.util.FloatProperty; import android.util.Log; import android.util.Log; import android.util.Property; import android.util.Property; Loading Loading @@ -73,7 +74,10 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi * want to scale them (in a way that doesn't require an asset dump) down 2dp. So * want to scale them (in a way that doesn't require an asset dump) down 2dp. So * 17dp * (15 / 17) = 15dp, the new height. * 17dp * (15 / 17) = 15dp, the new height. */ */ private static final float SYSTEM_ICON_SCALE = 15.f / 17.f; private static final float SYSTEM_ICON_DESIRED_HEIGHT = 15f; private static final float SYSTEM_ICON_INTRINSIC_HEIGHT = 17f; private static final float SYSTEM_ICON_SCALE = SYSTEM_ICON_DESIRED_HEIGHT / SYSTEM_ICON_INTRINSIC_HEIGHT; private final int ANIMATION_DURATION_FAST = 100; private final int ANIMATION_DURATION_FAST = 100; public static final int STATE_ICON = 0; public static final int STATE_ICON = 0; Loading Loading @@ -202,9 +206,26 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi updatePivot(); updatePivot(); } } // Makes sure that all icons are scaled to the same height (15dp). If we cannot get a height // for the icon, it uses the default SCALE (15f / 17f) which is the old behavior private void updateIconScaleForSystemIcons() { private void updateIconScaleForSystemIcons() { float iconHeight = getIconHeightInDps(); if (iconHeight != 0) { mIconScale = SYSTEM_ICON_DESIRED_HEIGHT / iconHeight; } else { mIconScale = SYSTEM_ICON_SCALE; mIconScale = SYSTEM_ICON_SCALE; } } } private float getIconHeightInDps() { Drawable d = getDrawable(); if (d != null) { return ((float) getDrawable().getIntrinsicHeight() * DisplayMetrics.DENSITY_DEFAULT) / mDensity; } else { return SYSTEM_ICON_INTRINSIC_HEIGHT; } } public float getIconScaleFullyDark() { public float getIconScaleFullyDark() { return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize; return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize; Loading @@ -221,8 +242,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi if (density != mDensity) { if (density != mDensity) { mDensity = density; mDensity = density; reloadDimens(); reloadDimens(); maybeUpdateIconScaleDimens(); updateDrawable(); updateDrawable(); maybeUpdateIconScaleDimens(); } } boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; == Configuration.UI_MODE_NIGHT_YES; Loading Loading @@ -305,6 +326,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi if (!updateDrawable(false /* no clear */)) return false; if (!updateDrawable(false /* no clear */)) return false; // we have to clear the grayscale tag since it may have changed // we have to clear the grayscale tag since it may have changed setTag(R.id.icon_is_grayscale, null); setTag(R.id.icon_is_grayscale, null); // Maybe set scale based on icon height maybeUpdateIconScaleDimens(); } } if (!levelEquals) { if (!levelEquals) { setImageLevel(icon.iconLevel); setImageLevel(icon.iconLevel); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class PhoneStatusBarPolicy private static final String TAG = "PhoneStatusBarPolicy"; private static final String TAG = "PhoneStatusBarPolicy"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); public static final int LOCATION_STATUS_ICON_ID = R.drawable.stat_sys_location; public static final int LOCATION_STATUS_ICON_ID = PrivacyType.TYPE_LOCATION.getIconId(); private final String mSlotCast; private final String mSlotCast; private final String mSlotHotspot; private final String mSlotHotspot; Loading Loading @@ -230,10 +230,10 @@ public class PhoneStatusBarPolicy mIconController.setIconVisibility(mSlotDataSaver, false); mIconController.setIconVisibility(mSlotDataSaver, false); // privacy items // privacy items mIconController.setIcon(mSlotMicrophone, R.drawable.stat_sys_mic_none, mIconController.setIcon(mSlotMicrophone, PrivacyType.TYPE_MICROPHONE.getIconId(), PrivacyType.TYPE_MICROPHONE.getName(mContext)); PrivacyType.TYPE_MICROPHONE.getName(mContext)); mIconController.setIconVisibility(mSlotMicrophone, false); mIconController.setIconVisibility(mSlotMicrophone, false); mIconController.setIcon(mSlotCamera, R.drawable.stat_sys_camera, mIconController.setIcon(mSlotCamera, PrivacyType.TYPE_CAMERA.getIconId(), PrivacyType.TYPE_CAMERA.getName(mContext)); PrivacyType.TYPE_CAMERA.getName(mContext)); mIconController.setIconVisibility(mSlotCamera, false); mIconController.setIconVisibility(mSlotCamera, false); mIconController.setIcon(mSlotLocation, LOCATION_STATUS_ICON_ID, mIconController.setIcon(mSlotLocation, LOCATION_STATUS_ICON_ID, Loading