<!-- The divider symbol between different parts of the notification header including spaces. not translatable [CHAR LIMIT=3] -->
<string name="notification_header_divider_symbol_with_spaces" translatable="false">" • "</string>
-
- <!-- url for new device suggestion -->
- <string name="new_device_suggestion_intro_url" translatable="false"></string>
</resources>
import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
-
import android.os.Bundle;
+
import com.android.settings.support.SupportPhone;
import java.lang.annotation.Retention;
* Starts support activity of specified type
*
* @param activity Calling activity
- * @param account A account that selected by user
- * @param type The type of support account needs.
+ * @param account A account that selected by user
+ * @param type The type of support account needs.
*/
void startSupport(Activity activity, Account account, @SupportType int type);
/**
* Checks if support v2 is enabled for this device.
+ *
* @return a boolean indicating if support v2 is enabled.
*/
boolean isSupportV2Enabled();
* launches the fragment that displays the system information being sent to support agents.
*/
void launchSystemInfoFragment(Bundle args, FragmentManager manager);
+
+ /**
+ * Returns a url with information to introduce user to new device.
+ */
+ String getNewDeviceIntroUrl(Context context);
}
import android.text.format.DateUtils;
import android.util.Log;
-import com.android.settings.R;
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.overlay.SupportFeatureProvider;
import java.util.List;
@VisibleForTesting
static Intent getLaunchIntent(Context context) {
- final String url = context.getString(R.string.new_device_suggestion_intro_url);
+ final SupportFeatureProvider supportProvider = FeatureFactory.getFactory(context)
+ .getSupportFeatureProvider(context);
+ if (supportProvider == null) {
+ return null;
+ }
+ final String url = supportProvider.getNewDeviceIntroUrl(context);
if (TextUtils.isEmpty(url)) {
return null;
}
+++ /dev/null
-<!--
- Copyright (C) 2017 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.
- -->
-
-<resources>
- <!-- url for new device suggestion -->
- <string name="new_device_suggestion_intro_url" translatable="false">http://www.com.android.settings.test.com</string>
-</resources>
import android.content.SharedPreferences;
import android.content.pm.ResolveInfo;
-import com.android.settings.R;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.testutils.FakeFeatureFactory;
@Test
public void isSuggestionComplete_noUrl_shouldReturnTrue() {
- assertThat(mContext.getString(R.string.new_device_suggestion_intro_url))
- .isEqualTo("");
+ when(mFeatureFactory.supportFeatureProvider.getNewDeviceIntroUrl(any(Context.class)))
+ .thenReturn(null);
assertThat(isSuggestionComplete(mContext))
.isTrue();
}
- // Use a non-default resource qualifier to load the test string in
- // res/values-mcc999/strings.xml.
- @Config(qualifiers = "mcc999")
@Test
public void isSuggestionComplete_alreadyLaunchedBefore_shouldReturnTrue() {
- assertThat(mContext.getString(R.string.new_device_suggestion_intro_url))
- .startsWith("http");
+ when(mFeatureFactory.supportFeatureProvider.getNewDeviceIntroUrl(any(Context.class)))
+ .thenReturn("https://com.android.settings");
+
getSharedPreferences().edit().putBoolean(PREF_KEY_SUGGGESTION_COMPLETE, true).commit();
assertThat(isSuggestionComplete(mContext))
.isTrue();
}
- // Use a non-default resource qualifier to load the test string in
- // res/values-mcc999/strings.xml.
- @Config(qualifiers = "mcc999")
@Test
public void isSuggestionComplete_notExpiredAndCanOpenUrlInBrowser_shouldReturnFalse() {
- assertThat(mContext.getString(R.string.new_device_suggestion_intro_url))
- .startsWith("http");
+ when(mFeatureFactory.supportFeatureProvider.getNewDeviceIntroUrl(any(Context.class)))
+ .thenReturn("https://com.android.settings");
final Intent intent = NewDeviceIntroSuggestionActivity.getLaunchIntent(mContext);
mRobolectricPackageManager.addResolveInfoForIntent(intent, new ResolveInfo());