diff options
author | Xin Li <delphij@google.com> | 2023-12-08 13:14:17 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-12-08 13:14:17 -0800 |
commit | aff0de653ef688b406fb6f8c4673d5b9697787f5 (patch) | |
tree | ade5ef9c1559e6edb0d39111943d082a9cac9888 | |
parent | fc5d366ce62d216abf7b8a535283343ca9fb3f32 (diff) | |
parent | ebef58c56a0ff9b2ea4ed0641b14c62ce45b5b12 (diff) | |
download | Cluster-aff0de653ef688b406fb6f8c4673d5b9697787f5.tar.gz |
Merge Android 14 QPR1
Merged-In: I5c113d614e5cfdc573706fbef7f1000918fd6305
Bug: 315507370
Change-Id: Ia594bd2e4e69be34d7ecbc82003995516214ec23
4 files changed, 37 insertions, 24 deletions
diff --git a/DirectRenderingCluster/res/layout/activity_fake_free_navigation.xml b/DirectRenderingCluster/res/layout/activity_fake_free_navigation.xml index ef56b1a..e83a049 100644 --- a/DirectRenderingCluster/res/layout/activity_fake_free_navigation.xml +++ b/DirectRenderingCluster/res/layout/activity_fake_free_navigation.xml @@ -38,12 +38,6 @@ android:layout_height="wrap_content" android:text="Free Navigation PlaceHolder" android:textSize="@dimen/title_text_size" /> - - <ProgressBar - android:id="@+id/indeterminateBar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - </LinearLayout> </RelativeLayout>
\ No newline at end of file diff --git a/DirectRenderingCluster/res/values/dimens.xml b/DirectRenderingCluster/res/values/dimens.xml index 2072f57..8e1bb50 100644 --- a/DirectRenderingCluster/res/values/dimens.xml +++ b/DirectRenderingCluster/res/values/dimens.xml @@ -23,7 +23,7 @@ <!-- --> <!-- Navigation state components --> <!-- --> - <dimen name="title_text_size">40sp</dimen> + <dimen name="title_text_size">15sp</dimen> <dimen name="nav_state_width">170dp</dimen> <!-- Maneuver --> <dimen name="maneuver_width">60dp</dimen> diff --git a/DirectRenderingCluster/src/android/car/cluster/MainClusterActivity.java b/DirectRenderingCluster/src/android/car/cluster/MainClusterActivity.java index 3b8d225..591cad6 100644 --- a/DirectRenderingCluster/src/android/car/cluster/MainClusterActivity.java +++ b/DirectRenderingCluster/src/android/car/cluster/MainClusterActivity.java @@ -200,6 +200,32 @@ public class MainClusterActivity extends FragmentActivity implements } } + private final BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver(){ + @Override + public void onReceive(final Context context, final Intent intent) { + if (!intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){ + return; + } + if (Log.isLoggable(TAG, Log.DEBUG)) { + Log.d(TAG, "ACTION_SCREEN_OFF"); + } + mNavStateController.hideNavigationStateInfo(); + } + }; + + private final BroadcastReceiver mUserPresentReceiver = new BroadcastReceiver(){ + @Override + public void onReceive(final Context context, final Intent intent) { + if (!intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { + return; + } + if (Log.isLoggable(TAG, Log.DEBUG)) { + Log.d(TAG, "ACTION_USER_PRESENT"); + } + mNavStateController.showNavigationStateInfo(); + } + }; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -230,22 +256,13 @@ public class MainClusterActivity extends FragmentActivity implements mOrderToFacet.get(NAV_FACET_ID).mButton.requestFocus(); mNavStateController = new NavStateController(findViewById(R.id.navigation_state)); - IntentFilter filter = new IntentFilter(); - filter.addAction(ACTION_USER_PRESENT); - filter.addAction(ACTION_SCREEN_OFF); - registerReceiver(new BroadcastReceiver(){ - @Override - public void onReceive(final Context context, final Intent intent) { - if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){ - Log.d(TAG, "ACTION_SCREEN_OFF"); - mNavStateController.hideNavigationStateInfo(); - } - else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { - Log.d(TAG, "ACTION_USER_PRESENT"); - mNavStateController.showNavigationStateInfo(); - } - } - }, filter); + IntentFilter screenOffFilter = new IntentFilter(); + screenOffFilter.addAction(ACTION_SCREEN_OFF); + registerReceiver(mScreenOffReceiver, screenOffFilter); + + IntentFilter userPresentFilter = new IntentFilter(); + userPresentFilter.addAction(ACTION_USER_PRESENT); + registerReceiver(mUserPresentReceiver, userPresentFilter); mClusterViewModel = new ViewModelProvider(this).get(ClusterViewModel.class); mClusterViewModel.getNavigationFocus().observe(this, focus -> { @@ -326,6 +343,8 @@ public class MainClusterActivity extends FragmentActivity implements mService = null; } unbindService(mClusterRenderingServiceConnection); + unregisterReceiver(mScreenOffReceiver); + unregisterReceiver(mUserPresentReceiver); } @Override diff --git a/DirectRenderingCluster/src/android/car/cluster/MusicFragmentViewModel.java b/DirectRenderingCluster/src/android/car/cluster/MusicFragmentViewModel.java index 0096daf..46163a8 100644 --- a/DirectRenderingCluster/src/android/car/cluster/MusicFragmentViewModel.java +++ b/DirectRenderingCluster/src/android/car/cluster/MusicFragmentViewModel.java @@ -47,7 +47,7 @@ public final class MusicFragmentViewModel extends AndroidViewModel { } mMediaSourceViewModel = mediaSourceViewModel; mMediaSource = mMediaSourceViewModel.getPrimaryMediaSource(); - mAppName = mapNonNull(mMediaSource, MediaSource::getDisplayName); + mAppName = mapNonNull(mMediaSource, source -> source.getDisplayName(getApplication())); mAppIcon = mapNonNull(mMediaSource, MediaSource::getCroppedPackageIcon); } |