Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb0ec555 authored by Takayuki Hoshi's avatar Takayuki Hoshi
Browse files

Do not show volume expander when there is no touch feature

Bug: 26099430
Change-Id: Ieeeb896dae824681a9a655849c84200a9f25214d
(cherry picked from commit e49bc6ea98c2eafdcdaedc3f6c9ffbe02ee48628)
parent ae10e136
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -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;
        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