Do not show volume expander when there is no touch feature

Bug: 26099430
Change-Id: Ieeeb896dae824681a9a655849c84200a9f25214d
(cherry picked from commit e49bc6ea98c2eafdcdaedc3f6c9ffbe02ee48628)
This commit is contained in:
Takayuki Hoshi
2015-12-17 20:50:25 +09:00
parent ae10e1368c
commit bb0ec55545

View File

@@ -27,6 +27,7 @@ import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
@@ -559,7 +560,13 @@ public class VolumeDialog {
: R.drawable.ic_volume_expand_animation;
if (res == mExpandButtonRes) return;
mExpandButtonRes = res;
mExpandButton.setImageResource(res);
if (hasTouchFeature()) {
mExpandButton.setImageResource(res);
} else {
// if there is no touch feature, show the volume ringer instead
mExpandButton.setImageResource(R.drawable.ic_volume_ringer);
mExpandButton.setBackgroundResource(0); // remove gray background emphasis
}
mExpandButton.setContentDescription(mContext.getString(mExpanded ?
R.string.accessibility_volume_collapse : R.string.accessibility_volume_expand));
}
@@ -837,6 +844,11 @@ public class VolumeDialog {
rescheduleTimeoutH();
}
private boolean hasTouchFeature() {
final PackageManager pm = mContext.getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
}
private final VolumeDialogController.Callbacks mControllerCallbackH
= new VolumeDialogController.Callbacks() {
@Override