1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.car.settings.qc; 18 19 import static com.android.car.settings.qc.SettingsQCRegistry.HOTSPOT_ROW_WITH_ACTION_URI; 20 21 import android.app.PendingIntent; 22 import android.content.Context; 23 import android.content.Intent; 24 import android.net.Uri; 25 26 /** 27 * {@link HotspotRow} with a primary action. 28 */ 29 public class HotspotRowWithAction extends HotspotRow { 30 private final Context mContext; 31 HotspotRowWithAction(Context context)32 public HotspotRowWithAction(Context context) { 33 super(context); 34 mContext = context; 35 } 36 37 @Override getUri()38 Uri getUri() { 39 return HOTSPOT_ROW_WITH_ACTION_URI; 40 } 41 42 @Override getPrimaryAction()43 protected PendingIntent getPrimaryAction() { 44 Intent intent = new Intent(mContext, 45 com.android.car.settings.common.CarSettingActivities.WifiTetherActivity.class); 46 intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT); 47 return PendingIntent.getActivity(mContext, /* requestCode= */ 0, intent, 48 /* flags= */ PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT); 49 } 50 } 51