summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Heemin Seog <hseog@google.com> 2020-04-21 17:05:20 -0700
committer Heemin Seog <hseog@google.com> 2020-04-21 17:07:56 -0700
commit9e9cccec142f2c97539f8d63df0c2c52ce527ca3 (patch)
tree06d8159313761932bed6c3c57ed98885398d0c06
parent11e0af370e2f84bcd283afec31770bf27705ac80 (diff)
Move Volume code to com.android.systemui.car.volume
Bug: 154357193 Test: manual Change-Id: Iece437827fe0344d713fcdc154ba3fa8f809f6d2
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java2
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogComponent.java (renamed from packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogComponent.java)7
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogImpl.java (renamed from packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java)55
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItem.java (renamed from packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java)8
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItemAdapter.java (renamed from packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItemAdapter.java)4
5 files changed, 41 insertions, 35 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index 4ea48ba24fa9..13a555692f22 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -25,6 +25,7 @@ import com.android.keyguard.KeyguardViewController;
import com.android.systemui.car.CarDeviceProvisionedController;
import com.android.systemui.car.CarDeviceProvisionedControllerImpl;
import com.android.systemui.car.keyguard.CarKeyguardViewController;
+import com.android.systemui.car.volume.CarVolumeDialogComponent;
import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
@@ -55,7 +56,6 @@ import com.android.systemui.statusbar.policy.BatteryControllerImpl;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
-import com.android.systemui.volume.CarVolumeDialogComponent;
import com.android.systemui.volume.VolumeDialogComponent;
import javax.inject.Named;
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogComponent.java b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogComponent.java
index 35ab322374e4..a22d1abc9c61 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogComponent.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-package com.android.systemui.volume;
+package com.android.systemui.car.volume;
import android.content.Context;
import com.android.systemui.car.CarServiceProvider;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.plugins.VolumeDialog;
+import com.android.systemui.volume.Events;
+import com.android.systemui.volume.VolumeDialogComponent;
+import com.android.systemui.volume.VolumeDialogControllerImpl;
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogImpl.java
index 2218eb587d9e..12818840af9a 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeDialogImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.volume;
+package com.android.systemui.car.volume;
import android.animation.Animator;
import android.animation.AnimatorInflater;
@@ -61,6 +61,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.systemui.R;
import com.android.systemui.car.CarServiceProvider;
import com.android.systemui.plugins.VolumeDialog;
+import com.android.systemui.volume.Events;
+import com.android.systemui.volume.SystemUIInterpolators;
+import com.android.systemui.volume.VolumeDialogImpl;
import org.xmlpull.v1.XmlPullParserException;
@@ -75,7 +78,8 @@ import java.util.List;
*/
public class CarVolumeDialogImpl implements VolumeDialog {
- private static final String TAG = Util.logTag(CarVolumeDialogImpl.class);
+ private static final String TAG = "CarVolumeDialog";
+ private static final boolean DEBUG = false;
private static final String XML_TAG_VOLUME_ITEMS = "carVolumeItems";
private static final String XML_TAG_VOLUME_ITEM = "item";
@@ -134,9 +138,9 @@ public class CarVolumeDialogImpl implements VolumeDialog {
// this
// callback. Updating the seekbar at the same time could block the continuous
// seeking.
- if (value != volumeItem.progress && isShowing) {
- volumeItem.carVolumeItem.setProgress(value);
- volumeItem.progress = value;
+ if (value != volumeItem.mProgress && isShowing) {
+ volumeItem.mCarVolumeItem.setProgress(value);
+ volumeItem.mProgress = value;
}
if ((flags & AudioManager.FLAG_SHOW_UI) != 0) {
mPreviouslyDisplayingGroupId = mCurrentlyDisplayingGroupId;
@@ -307,7 +311,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
private void showH(int reason) {
- if (D.BUG) {
+ if (DEBUG) {
Log.d(TAG, "showH r=" + Events.DISMISS_REASONS[reason]);
}
@@ -337,7 +341,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
private void clearAllAndSetupDefaultCarVolumeLineItem(int groupId) {
mCarVolumeLineItems.clear();
VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
- volumeItem.defaultItem = true;
+ volumeItem.mDefaultItem = true;
addCarVolumeListItem(volumeItem, /* volumeGroupId = */ groupId,
R.drawable.car_ic_keyboard_arrow_down, new ExpandIconListener());
}
@@ -348,7 +352,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
mHandler.sendMessageDelayed(mHandler
.obtainMessage(H.DISMISS, Events.DISMISS_REASON_TIMEOUT), timeout);
- if (D.BUG) {
+ if (DEBUG) {
Log.d(TAG, "rescheduleTimeout " + timeout + " " + Debug.getCaller());
}
}
@@ -362,7 +366,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
}
private void dismissH(int reason) {
- if (D.BUG) {
+ if (DEBUG) {
Log.d(TAG, "dismissH r=" + Events.DISMISS_REASONS[reason]);
}
@@ -379,7 +383,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
.setDuration(LISTVIEW_ANIMATION_DURATION_IN_MILLIS)
.setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
.withEndAction(() -> mHandler.postDelayed(() -> {
- if (D.BUG) {
+ if (DEBUG) {
Log.d(TAG, "mDialog.dismiss()");
}
mDialog.dismiss();
@@ -424,8 +428,8 @@ public class CarVolumeDialogImpl implements VolumeDialog {
/* defValue= */ -1);
if (usage >= 0) {
VolumeItem volumeItem = new VolumeItem();
- volumeItem.rank = rank;
- volumeItem.icon = item.getResourceId(
+ volumeItem.mRank = rank;
+ volumeItem.mIcon = item.getResourceId(
R.styleable.carVolumeItems_item_icon, /* defValue= */ 0);
mVolumeItems.put(usage, volumeItem);
rank++;
@@ -443,8 +447,8 @@ public class CarVolumeDialogImpl implements VolumeDialog {
VolumeItem result = null;
for (int usage : usages) {
VolumeItem volumeItem = mVolumeItems.get(usage);
- if (volumeItem.rank < rank) {
- rank = volumeItem.rank;
+ if (volumeItem.mRank < rank) {
+ rank = volumeItem.mRank;
result = volumeItem;
}
}
@@ -463,7 +467,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
carVolumeItem.setGroupId(volumeGroupId);
int color = mContext.getColor(R.color.car_volume_dialog_tint);
- Drawable primaryIcon = mContext.getDrawable(volumeItem.icon);
+ Drawable primaryIcon = mContext.getDrawable(volumeItem.mIcon);
primaryIcon.mutate().setTint(color);
carVolumeItem.setPrimaryIcon(primaryIcon);
if (supplementalIcon != null) {
@@ -476,8 +480,8 @@ public class CarVolumeDialogImpl implements VolumeDialog {
/* showSupplementalIconDivider= */ false);
}
- volumeItem.carVolumeItem = carVolumeItem;
- volumeItem.progress = seekbarProgressValue;
+ volumeItem.mCarVolumeItem = carVolumeItem;
+ volumeItem.mProgress = seekbarProgressValue;
return carVolumeItem;
}
@@ -504,13 +508,12 @@ public class CarVolumeDialogImpl implements VolumeDialog {
* Wrapper class which contains information of each volume group.
*/
private static class VolumeItem {
-
- private int rank;
- private boolean defaultItem = false;
+ private int mRank;
+ private boolean mDefaultItem = false;
@DrawableRes
- private int icon;
- private CarVolumeItem carVolumeItem;
- private int progress;
+ private int mIcon;
+ private CarVolumeItem mCarVolumeItem;
+ private int mProgress;
}
private final class H extends Handler {
@@ -638,9 +641,9 @@ public class CarVolumeDialogImpl implements VolumeDialog {
Log.w(TAG, "Ignoring volume change event because the car isn't connected");
return;
}
- mAvailableVolumeItems.get(mVolumeGroupId).progress = progress;
+ mAvailableVolumeItems.get(mVolumeGroupId).mProgress = progress;
mAvailableVolumeItems.get(
- mVolumeGroupId).carVolumeItem.setProgress(progress);
+ mVolumeGroupId).mCarVolumeItem.setProgress(progress);
mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0);
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItem.java
index b83740f4259d..1e7e5348b7fa 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.volume;
+package com.android.systemui.car.volume;
import android.graphics.drawable.Drawable;
import android.view.View;
@@ -38,12 +38,12 @@ public class CarVolumeItem {
private int mMax;
private int mProgress;
private SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener;
-
+
/**
* Called when {@link CarVolumeItem} is bound to its ViewHolder.
*/
void bind(CarVolumeItemViewHolder viewHolder) {
- viewHolder.bind(/* carVolumeItem= */ this);
+ viewHolder.bind(/* carVolumeItem= */ this);
}
/** Sets progress of seekbar. */
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItemAdapter.java b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItemAdapter.java
index 5c1f8170afc4..7f336b5250a7 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItemAdapter.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/volume/CarVolumeItemAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.volume;
+package com.android.systemui.car.volume;
import android.content.Context;
import android.view.LayoutInflater;