Merge "Change view/window visibility when indicator is shown/hidden. Change the window title"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
index d6d0a36..9b685f0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/AudioRecordingDisclosureBar.java
@@ -30,6 +30,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewPropertyAnimator;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.ImageView;
@@ -45,7 +46,10 @@
private static final String TAG = "AudioRecordingDisclosureBar";
private static final boolean DEBUG = false;
- private static final String LAYOUT_PARAMS_TITLE = "AudioRecordingDisclosureBar";
+ // This title is used to test the microphone disclosure indicator in
+ // CtsSystemUiHostTestCases:TvMicrophoneCaptureIndicatorTest
+ private static final String LAYOUT_PARAMS_TITLE = "MicrophoneCaptureIndicator";
+
private static final int ANIM_DURATION_MS = 150;
private final Context mContext;
@@ -70,6 +74,7 @@
}
private void createView() {
+ //TODO(b/142228704): this is to be re-implemented once proper design is completed
mView = View.inflate(mContext,
R.layout.tv_status_bar_audio_recording, null);
mAppsInfoContainer = mView.findViewById(R.id.container);
@@ -88,7 +93,7 @@
Context.WINDOW_SERVICE);
windowManager.addView(mView, layoutParams);
- // Set invisible first util it gains its actual size and we are able to hide it by moving
+ // Set invisible first until it gains its actual size and we are able to hide it by moving
// off the screen
mView.setVisibility(View.INVISIBLE);
mView.getViewTreeObserver().addOnGlobalLayoutListener(
@@ -98,16 +103,18 @@
// Now that we get the height, we can move the bar off ("below") the screen
final int height = mView.getHeight();
mView.setTranslationY(height);
- // ... and make it visible
- mView.setVisibility(View.VISIBLE);
// Remove the observer
mView.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
+ // Now, that the view has been measured, and the translation was set to
+ // move it off the screen, we change the visibility to GONE
+ mView.setVisibility(View.GONE);
}
});
}
private void showAudioRecordingDisclosureBar() {
+ mView.setVisibility(View.VISIBLE);
mView.animate()
.translationY(0f)
.setDuration(ANIM_DURATION_MS)
@@ -138,9 +145,10 @@
}
private void hideAudioRecordingDisclosureBar() {
- mView.animate()
- .translationY(mView.getHeight())
+ final ViewPropertyAnimator animator = mView.animate();
+ animator.translationY(mView.getHeight())
.setDuration(ANIM_DURATION_MS)
+ .withEndAction(() -> mView.setVisibility(View.GONE))
.start();
}
@@ -156,7 +164,7 @@
public void onOpActiveChanged(String op, int uid, String packageName, boolean active) {
if (DEBUG) {
Log.d(TAG,
- "OP_RECORD_AUDIO active change, active" + active + ", app=" + packageName);
+ "OP_RECORD_AUDIO active change, active=" + active + ", app=" + packageName);
}
if (mExemptApps.contains(packageName)) {