Snap for 4784261 from 37a6a91444 to pi-release
Change-Id: I13ea5ca9538b24c344030bf20f206a8d9399267c
This commit is contained in:
@@ -207,8 +207,6 @@
|
||||
android:value="com.android.settings.category.ia.homepage"/>
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
<meta-data android:name="android.metadata.SLICE_URI"
|
||||
android:value="content://android.settings.slices/action/toggle_bluetooth_switch" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="AirplaneModeVoiceActivity"
|
||||
@@ -253,8 +251,6 @@
|
||||
android:value="com.android.settings.wifi.WifiSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
<meta-data android:name="android.metadata.SLICE_URI"
|
||||
android:value="content://android.settings.slices/wifi" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
@@ -745,7 +741,7 @@
|
||||
<activity
|
||||
android:name=".notification.ZenSuggestionActivity"
|
||||
android:label="@string/zen_mode_settings_title"
|
||||
android:icon="@drawable/ic_zen"
|
||||
android:icon="@drawable/ic_do_not_disturb_on_24dp"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -2246,8 +2242,6 @@
|
||||
android:value="com.android.settings.category.ia.homepage" />
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.fuelgauge.PowerUsageSummary" />
|
||||
<meta-data android:name="android.metadata.SLICE_URI"
|
||||
android:value="content://android.settings.slices/action/auto_brightness" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
@@ -2264,8 +2258,6 @@
|
||||
android:value="com.android.settings.fuelgauge.batterysaver.BatterySaverSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
<meta-data android:name="android.metadata.SLICE_URI"
|
||||
android:value="content://android.settings.slices/action/battery_saver_summary" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".fuelgauge.BatterySaverModeVoiceActivity"
|
||||
@@ -2687,8 +2679,6 @@
|
||||
android:value="true" />
|
||||
<meta-data android:name="com.android.settings.summary"
|
||||
android:resource="@string/sound_dashboard_summary"/>
|
||||
<meta-data android:name="android.metadata.SLICE_URI"
|
||||
android:value="content://android.settings.slices/action/alarm_volume" />
|
||||
</activity>
|
||||
|
||||
<!-- Show apps for which application-level notification settings are applicable -->
|
||||
|
||||
28
res/drawable/ic_do_not_disturb_on_24dp.xml
Normal file
28
res/drawable/ic_do_not_disturb_on_24dp.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<!--
|
||||
Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-4.41 3.59,-8 8,-8c4.41,0 8,3.59 8,8C20,16.41 16.41,20 12,20z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M7,11h10v2h-10z"/>
|
||||
</vector>
|
||||
@@ -32,5 +32,5 @@
|
||||
android:height="@dimen/dashboard_tile_foreground_image_size"
|
||||
android:start="@dimen/dashboard_tile_foreground_image_inset"
|
||||
android:top="@dimen/dashboard_tile_foreground_image_inset"
|
||||
android:drawable="@drawable/ic_settings_sound_white" />
|
||||
android:drawable="@drawable/ic_volume_up_24dp" />
|
||||
</layer-list>
|
||||
|
||||
31
res/drawable/ic_notifications_off_24dp.xml
Normal file
31
res/drawable/ic_notifications_off_24dp.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:autoMirrored="true"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:width="24dp"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path android:fillColor="#FF000000"
|
||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z" />
|
||||
<path android:fillColor="#FF000000"
|
||||
android:pathData="M16,16L2.81,2.81L1.39,4.22l4.85,4.85C6.09,9.68 6,10.33 6,11v6H4v2h12.17l3.61,3.61l1.41,-1.41L16,16zM8,17c0,0 0.01,-6.11 0.01,-6.16L14.17,17H8z" />
|
||||
<path android:fillColor="#FF000000"
|
||||
android:pathData="M12,6.5c2.49,0 4,2.02 4,4.5v2.17l2,2V11c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.72,4.86 9.05,5.2 8.46,5.63L9.93,7.1C10.51,6.73 11.2,6.5 12,6.5z" />
|
||||
</vector>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="23.4"
|
||||
android:viewportWidth="23.3"
|
||||
android:width="24dp"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
|
||||
<group
|
||||
android:translateX="-0.85"
|
||||
android:translateY="-0.5">
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M20.73,19.46l-0.6,-0.6c0,0 0,0 0,0L5.54,4.26c-0.35,-0.35 -0.92,-0.35 -1.27,0c-0.35,0.35 -0.35,0.92 0,1.27l2.4,2.4C6.25,8.85 6,9.88 6,11v5l-2.15,2.15c-0.19,0.2 -0.19,0.51 0.01,0.71C3.95,18.95 4.07,19 4.2,19h13.53l1.73,1.73c0.35,0.35 0.92,0.35 1.27,0C21.09,20.38 21.09,19.81 20.73,19.46z" />
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M18,11c0,-3.07 -1.64,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.87,4.83 9.31,5.08 8.8,5.4l9.2,9.2V11z" />
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z" />
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -13,17 +13,19 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24.0dp"
|
||||
android:height="24.0dp"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M3 10v4c0 .55 .45 1 1 1h3l3.29 3.29c.63 .63 1.71 .18
|
||||
1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0
|
||||
0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.46v.19c0 .38 .25 .71 .61
|
||||
.85C17.18 6.54 19 9.06 19 12s-1.82 5.46-4.39 6.5c-.36 .14 -.61 .47 -.61 .85
|
||||
v.19c0 .63 .63 1.08 1.22 .86 a8.995 8.995 0 0 0 0-16.8c-.59-.23-1.22 .23 -1.22
|
||||
.86 z"/>
|
||||
android:pathData="M3,9v6h4l5,5V4L7,9H3zM10,8.83v6.34L7.83,13H5v-2h2.83L10,8.83z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05C15.48,15.29 16.5,13.77 16.5,12z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M14,3.23v2.06c2.89,0.86 5,3.54 5,6.71c0,3.17 -2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77C21,7.72 18.01,4.14 14,3.23z"/>
|
||||
</vector>
|
||||
@@ -1,26 +0,0 @@
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:height="24dp"
|
||||
android:width="24dp" >
|
||||
|
||||
<path
|
||||
android:fillColor="?android:attr/colorControlActivated"
|
||||
android:pathData="M 12 2 C 6.48 2 2 6.48 2 12 s 4.48 10 10 10 10 -4.48 10 -10 S 17.52 2 12 2 z m 4 11 H 8 c -.55 0 -1 -.45 -1 -1 s .45 -1 1 -1 h 8c.55 0 1 .45 1 1 s -.45 1 -1 1z" />
|
||||
|
||||
</vector>
|
||||
@@ -6918,9 +6918,13 @@
|
||||
<!-- Title for setting tile leading to Connected devices settings [CHAR LIMIT=40]-->
|
||||
<string name="connected_devices_dashboard_title">Connected devices</string>
|
||||
<!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
<string name="connected_devices_dashboard_summary">Bluetooth, Cast, NFC</string>
|
||||
<string name="connected_devices_dashboard_summary">Bluetooth, driving mode, NFC</string>
|
||||
<!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
<string name="connected_devices_dashboard_no_nfc_summary">Bluetooth, Cast</string>
|
||||
<string name="connected_devices_dashboard_no_nfc_summary">Bluetooth, driving mode</string>
|
||||
<!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
<string name="connected_devices_dashboard_no_driving_mode_summary">Bluetooth, NFC</string>
|
||||
<!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
<string name="connected_devices_dashboard_no_driving_mode_no_nfc_summary">Bluetooth</string>
|
||||
<!-- Title for setting tile leading to Apps & Notification settings [CHAR LIMIT=40]-->
|
||||
<string name="app_and_notification_dashboard_title">Apps & notifications</string>
|
||||
<!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
android:icon="@drawable/ic_local_phone_24_lib"
|
||||
android:title="@string/call_volume_option_title"
|
||||
android:order="-170"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:controller="com.android.settings.notification.CallVolumePreferenceController"/>
|
||||
|
||||
<!-- Hands free profile output switcher -->
|
||||
@@ -61,8 +60,7 @@
|
||||
android:icon="@*android:drawable/ic_audio_ring_notif"
|
||||
android:title="@string/ring_volume_option_title"
|
||||
android:order="-160"
|
||||
settings:controller="com.android.settings.notification.RingVolumePreferenceController"
|
||||
settings:allowDividerAbove="true"/>
|
||||
settings:controller="com.android.settings.notification.RingVolumePreferenceController"/>
|
||||
|
||||
<!-- Also vibrate for calls -->
|
||||
<SwitchPreference
|
||||
@@ -76,7 +74,6 @@
|
||||
android:icon="@*android:drawable/ic_audio_alarm"
|
||||
android:title="@string/alarm_volume_option_title"
|
||||
android:order="-150"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:controller="com.android.settings.notification.AlarmVolumePreferenceController"/>
|
||||
|
||||
<!-- Notification volume -->
|
||||
@@ -102,7 +99,6 @@
|
||||
android:title="@string/gesture_prevent_ringing_sound_title"
|
||||
android:order="-110"
|
||||
android:fragment="com.android.settings.gestures.PreventRingingGestureSettings"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:controller="com.android.settings.gestures.PreventRingingPreferenceController" />
|
||||
|
||||
<!-- Phone ringtone -->
|
||||
|
||||
@@ -276,7 +276,7 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
mSummaryLoader.updateSummaryToCache(category);
|
||||
mStagingCategory = category;
|
||||
if (mSuggestionControllerMixin == null) {
|
||||
mAdapter.setCategory(mStagingCategory);
|
||||
ThreadUtils.postOnMainThread(() -> mAdapter.setCategory(mStagingCategory));
|
||||
return;
|
||||
}
|
||||
if (mSuggestionControllerMixin.isSuggestionLoaded()) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DndCondition extends Condition {
|
||||
|
||||
@Override
|
||||
public Drawable getIcon() {
|
||||
return mManager.getContext().getDrawable(R.drawable.ic_zen);
|
||||
return mManager.getContext().getDrawable(R.drawable.ic_do_not_disturb_on_24dp);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class RingerMutedCondition extends AbnormalRingerConditionBase {
|
||||
|
||||
@Override
|
||||
public Drawable getIcon() {
|
||||
return mManager.getContext().getDrawable(R.drawable.ic_volume_ringer_mute);
|
||||
return mManager.getContext().getDrawable(R.drawable.ic_notifications_off_24dp);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.notification;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.arch.lifecycle.LifecycleObserver;
|
||||
import android.arch.lifecycle.OnLifecycleEvent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -47,6 +46,8 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
private final RingReceiver mReceiver = new RingReceiver();
|
||||
private final H mHandler = new H();
|
||||
|
||||
private int mMuteIcon;
|
||||
|
||||
public RingVolumePreferenceController(Context context) {
|
||||
this(context, KEY_RING_VOLUME);
|
||||
}
|
||||
@@ -94,7 +95,7 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
|
||||
@Override
|
||||
public int getMuteIcon() {
|
||||
return R.drawable.ic_volume_ringer_vibrate;
|
||||
return mMuteIcon;
|
||||
}
|
||||
|
||||
private void updateRingerMode() {
|
||||
@@ -104,11 +105,6 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
updatePreferenceIcon();
|
||||
}
|
||||
|
||||
private boolean wasRingerModeVibrate() {
|
||||
return mVibrator != null && mRingerMode == AudioManager.RINGER_MODE_SILENT
|
||||
&& mHelper.getLastAudibleStreamVolume(getAudioStream()) == 0;
|
||||
}
|
||||
|
||||
private void updateEffectsSuppressor() {
|
||||
final ComponentName suppressor = NotificationManager.from(mContext).getEffectsSuppressor();
|
||||
if (Objects.equals(suppressor, mSuppressor)) return;
|
||||
@@ -122,10 +118,15 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
|
||||
private void updatePreferenceIcon() {
|
||||
if (mPreference != null) {
|
||||
mPreference.showIcon(
|
||||
mRingerMode == AudioManager.RINGER_MODE_VIBRATE || wasRingerModeVibrate()
|
||||
? com.android.internal.R.drawable.ic_audio_ring_notif_vibrate
|
||||
: com.android.internal.R.drawable.ic_audio_ring_notif);
|
||||
if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
|
||||
mMuteIcon = R.drawable.ic_volume_ringer_vibrate;
|
||||
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif_vibrate);
|
||||
} else if (mRingerMode == AudioManager.RINGER_MODE_SILENT) {
|
||||
mMuteIcon = R.drawable.ic_notifications_off_24dp;
|
||||
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif_mute);
|
||||
} else {
|
||||
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface DeviceIndexFeatureProvider {
|
||||
context.getSystemService(JobScheduler.class).schedule(
|
||||
new JobInfo.Builder(jobId, jobComponent)
|
||||
.setPersisted(true)
|
||||
.setMinimumLatency(1)
|
||||
.setMinimumLatency(1000)
|
||||
.setOverrideDeadline(1)
|
||||
.build());
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class DeviceIndexUpdateJobService extends JobService {
|
||||
}
|
||||
|
||||
protected CharSequence findTitle(Slice loadedSlice, SliceMetadata metaData) {
|
||||
ListContent content = new ListContent(this, loadedSlice);
|
||||
ListContent content = new ListContent(null, loadedSlice);
|
||||
SliceItem headerItem = content.getHeaderItem();
|
||||
if (headerItem == null) {
|
||||
if (content.getRowItems().size() != 0) {
|
||||
|
||||
@@ -20,9 +20,12 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
@@ -47,6 +50,8 @@ public class NewDeviceIntroSuggestionActivity extends Activity {
|
||||
@VisibleForTesting
|
||||
static final long PERMANENT_DISMISS_THRESHOLD = DateUtils.DAY_IN_MILLIS * 14;
|
||||
|
||||
public static final String TIPS_PACKAGE_NAME = "com.google.android.apps.tips";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -62,7 +67,9 @@ public class NewDeviceIntroSuggestionActivity extends Activity {
|
||||
}
|
||||
|
||||
public static boolean isSuggestionComplete(Context context) {
|
||||
return !isSupported(context)
|
||||
// Always returns 'true' if Tips application exists. Check b/77652536 for more details.
|
||||
return isTipsInstalledAsSystemApp(context)
|
||||
|| !isSupported(context)
|
||||
|| isExpired(context)
|
||||
|| hasLaunchedBefore(context)
|
||||
|| !canOpenUrlInBrowser(context);
|
||||
@@ -130,4 +137,18 @@ public class NewDeviceIntroSuggestionActivity extends Activity {
|
||||
.addCategory(Intent.CATEGORY_BROWSABLE)
|
||||
.setData(Uri.parse(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified package exists and is marked with <i>FLAG_SYSTEM</i>
|
||||
*/
|
||||
private static boolean isTipsInstalledAsSystemApp(@NonNull Context context) {
|
||||
try {
|
||||
final PackageInfo info = context.getPackageManager().getPackageInfo(TIPS_PACKAGE_NAME,
|
||||
PackageManager.MATCH_SYSTEM_ONLY);
|
||||
return info != null;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(TAG, "Cannot find the package: " + TIPS_PACKAGE_NAME, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ package com.android.settings.support;
|
||||
import static com.android.settings.support.NewDeviceIntroSuggestionActivity.PERMANENT_DISMISS_THRESHOLD;
|
||||
import static com.android.settings.support.NewDeviceIntroSuggestionActivity.PREF_KEY_SUGGGESTION_COMPLETE;
|
||||
import static com.android.settings.support.NewDeviceIntroSuggestionActivity.PREF_KEY_SUGGGESTION_FIRST_DISPLAY_TIME;
|
||||
|
||||
import static com.android.settings.support.NewDeviceIntroSuggestionActivity.TIPS_PACKAGE_NAME;
|
||||
import static com.android.settings.support.NewDeviceIntroSuggestionActivity.isSuggestionComplete;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -27,6 +30,7 @@ import static org.mockito.Mockito.when;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.ResolveInfo;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -64,6 +68,40 @@ public class NewDeviceIntroSuggestionActivityTest {
|
||||
.thenReturn(getSharedPreferences());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSuggestionComplete_TipsNotExistsAndNotExpiredAndCanOpenUrl_shouldReturnFalse() {
|
||||
mShadowPackageManager.removePackage(TIPS_PACKAGE_NAME);
|
||||
|
||||
when(mMockContext.getResources()
|
||||
.getBoolean(R.bool.config_new_device_intro_suggestion_supported))
|
||||
.thenReturn(true);
|
||||
|
||||
when(mFeatureFactory.supportFeatureProvider.getNewDeviceIntroUrl(any(Context.class)))
|
||||
.thenReturn("https://com.android.settings");
|
||||
final Intent intent = NewDeviceIntroSuggestionActivity.getLaunchIntent(mContext);
|
||||
mShadowPackageManager.addResolveInfoForIntent(intent, new ResolveInfo());
|
||||
|
||||
assertThat(isSuggestionComplete(mContext)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSuggestionComplete_TipsExistsAndNotExpiredAndCanOpenUrl_shouldReturnTrue() {
|
||||
final PackageInfo mockInfo = new PackageInfo();
|
||||
mockInfo.packageName = TIPS_PACKAGE_NAME;
|
||||
mShadowPackageManager.addPackage(mockInfo);
|
||||
|
||||
when(mMockContext.getResources()
|
||||
.getBoolean(R.bool.config_new_device_intro_suggestion_supported))
|
||||
.thenReturn(true);
|
||||
|
||||
when(mFeatureFactory.supportFeatureProvider.getNewDeviceIntroUrl(any(Context.class)))
|
||||
.thenReturn("https://com.android.settings");
|
||||
final Intent intent = NewDeviceIntroSuggestionActivity.getLaunchIntent(mContext);
|
||||
mShadowPackageManager.addResolveInfoForIntent(intent, new ResolveInfo());
|
||||
|
||||
assertThat(isSuggestionComplete(mContext)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSuggestionComplete_notSupported_shouldReturnTrue() {
|
||||
when(mMockContext.getResources()
|
||||
|
||||
Reference in New Issue
Block a user