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

Commit 66b2b91d authored by Yanting Yang's avatar Yanting Yang
Browse files

Fix deep link issue of Slice cards in home page

Add setData(uri) back to intent to fix deep link launching error.

Change-Id: Ibffce43ddeb9a1388d001515d8d3b320c5b45520
Fixes: 120473478
Test: robotests, visual
parent e8ac1019
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.settings.homepage.contextualcards.deviceinfo;

import static com.android.settings.slices.CustomSliceRegistry.BATTERY_INFO_SLICE_URI;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -37,6 +35,7 @@ import com.android.settings.SubSettings;
import com.android.settings.Utils;
import com.android.settings.fuelgauge.BatteryInfo;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settings.slices.CustomSliceable;
import com.android.settings.slices.SliceBuilderUtils;

@@ -66,7 +65,8 @@ public class BatterySlice implements CustomSliceable {
        final CharSequence title = mContext.getText(R.string.power_usage_summary_title);
        final SliceAction primarySliceAction = SliceAction.createDeeplink(getPrimaryAction(), icon,
                ListBuilder.ICON_IMAGE, title);
        final Slice slice = new ListBuilder(mContext, BATTERY_INFO_SLICE_URI, ListBuilder.INFINITY)
        final Slice slice = new ListBuilder(mContext, CustomSliceRegistry.BATTERY_INFO_SLICE_URI,
                ListBuilder.INFINITY)
                .setAccentColor(Utils.getColorAccentDefaultColor(mContext))
                .setHeader(new ListBuilder.HeaderBuilder().setTitle(title))
                .addRow(new ListBuilder.RowBuilder()
@@ -81,7 +81,7 @@ public class BatterySlice implements CustomSliceable {

    @Override
    public Uri getUri() {
        return BATTERY_INFO_SLICE_URI;
        return CustomSliceRegistry.BATTERY_INFO_SLICE_URI;
    }

    @Override
@@ -95,7 +95,8 @@ public class BatterySlice implements CustomSliceable {
        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
                PowerUsageSummary.class.getName(), "" /* key */, screenTitle,
                MetricsProto.MetricsEvent.SLICE)
                .setClassName(mContext.getPackageName(), SubSettings.class.getName());
                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
                .setData(CustomSliceRegistry.BATTERY_INFO_SLICE_URI);
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@ public class DataUsageSlice implements CustomSliceable {
        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
                DataUsageSummary.class.getName(), "" /* key */, screenTitle,
                MetricsProto.MetricsEvent.SLICE)
                .setClassName(mContext.getPackageName(), SubSettings.class.getName());
                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
                .setData(CustomSliceRegistry.DATA_USAGE_SLICE_URI);
    }

    private PendingIntent getPrimaryAction() {
+2 −1
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ public class DeviceInfoSlice implements CustomSliceable {
        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
                MyDeviceInfoFragment.class.getName(), "" /* key */, screenTitle,
                MetricsProto.MetricsEvent.SLICE)
                .setClassName(mContext.getPackageName(), SubSettings.class.getName());
                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
                .setData(CustomSliceRegistry.DEVICE_INFO_SLICE_URI);
    }

    private PendingIntent getPrimaryAction() {
+2 −1
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ public class StorageSlice implements CustomSliceable {
        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
                StorageDashboardFragment.class.getName(), "" /* key */, screenTitle,
                MetricsProto.MetricsEvent.SLICE)
                .setClassName(mContext.getPackageName(), SubSettings.class.getName());
                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
                .setData(CustomSliceRegistry.STORAGE_SLICE_URI);
    }

    private PendingIntent getPrimaryAction() {
+2 −1
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ public class ConnectedDeviceSlice implements CustomSliceable {
                ConnectedDeviceDashboardFragment.class.getName(), "" /* key */,
                screenTitle,
                MetricsProto.MetricsEvent.SLICE)
                .setClassName(mContext.getPackageName(), SubSettings.class.getName());
                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
                .setData(CustomSliceRegistry.CONNECTED_DEVICE_SLICE_URI);
    }

    @Override
Loading