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

Commit e62554c5 authored by Priyank Singh's avatar Priyank Singh
Browse files

Maps should be launched via Implicit Intent instead of Car Launcher.

Bug: 135129435
Test: Manual
Change-Id: I81c1b608a8a0a10353e8a706869af9c1d300d719
parent e52531fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@
            style="@style/NavigationBarButton"
            systemui:categories="android.intent.category.APP_MAPS"
            systemui:icon="@drawable/car_ic_navigation"
            systemui:intent="intent:#Intent;component=com.android.car.carlauncher/.CarLauncher;category=android.intent.category.APP_MAPS;launchFlags=0x24000000;end"
            systemui:intent="intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;launchFlags=0x14000000;end"
            systemui:selectedIcon="@drawable/car_ic_navigation_selected"
            systemui:useMoreIcon="false"
        />
+14 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.car;

import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -33,9 +34,11 @@ import com.android.systemui.SystemUIFactory;

/**
 * CarFacetButton is a ui component designed to be used as a shortcut for an app of a defined
 * category. It can also render a indicator impling that there are more options of apps to launch
 * category. It can also render a indicator implying that there are more options of apps to launch
 * using this component. This is done with a "More icon" currently an arrow as defined in the layout
 * file. The class is to serve as an example.
 *
 * New activity will be launched on the same display as the button is on.
 * Usage example: A button that allows a user to select a music app and indicate that there are
 * other music apps installed.
 */
@@ -111,15 +114,20 @@ public class CarFacetButton extends LinearLayout {
            }

            setOnClickListener(v -> {
                ActivityOptions options = ActivityOptions.makeBasic();
                options.setLaunchDisplayId(mContext.getDisplayId());
                intent.putExtra(EXTRA_FACET_LAUNCH_PICKER, mSelected);
                mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                mContext.startActivityAsUser(intent, options.toBundle(), UserHandle.CURRENT);
            });

            if (longPressIntentString != null) {
                final Intent longPressIntent = Intent.parseUri(longPressIntentString,
                        Intent.URI_INTENT_SCHEME);
                setOnLongClickListener(v -> {
                    mContext.startActivityAsUser(longPressIntent, UserHandle.CURRENT);
                    ActivityOptions options = ActivityOptions.makeBasic();
                    options.setLaunchDisplayId(mContext.getDisplayId());
                    mContext.startActivityAsUser(longPressIntent, options.toBundle(),
                            UserHandle.CURRENT);
                    return true;
                });
            }
+9 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.car;

import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -96,7 +97,10 @@ public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImag
                            mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
                            return;
                        }
                        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                        ActivityOptions options = ActivityOptions.makeBasic();
                        options.setLaunchDisplayId(mContext.getDisplayId());
                        mContext.startActivityAsUser(intent, options.toBundle(),
                                UserHandle.CURRENT);
                    } catch (Exception e) {
                        Log.e(TAG, "Failed to launch intent", e);
                    }
@@ -111,7 +115,10 @@ public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImag
                final Intent intent = Intent.parseUri(mLongIntent, Intent.URI_INTENT_SCHEME);
                setOnLongClickListener(v -> {
                    try {
                        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                        ActivityOptions options = ActivityOptions.makeBasic();
                        options.setLaunchDisplayId(mContext.getDisplayId());
                        mContext.startActivityAsUser(intent, options.toBundle(),
                                UserHandle.CURRENT);
                    } catch (Exception e) {
                        Log.e(TAG, "Failed to launch intent", e);
                    }