diff --git a/res/values/strings.xml b/res/values/strings.xml index c5f1c4f0460..f7dc03bdc2d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -8959,7 +8959,7 @@ - What's new and exciting? + What\'s new and exciting? Check out the top 5 features diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java index c9e0805509f..8f649209636 100644 --- a/src/com/android/settings/widget/EntityHeaderController.java +++ b/src/com/android/settings/widget/EntityHeaderController.java @@ -52,6 +52,10 @@ import com.android.settingslib.core.lifecycle.Lifecycle; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import static com.android.internal.logging.nano.MetricsProto.MetricsEvent + .ACTION_OPEN_APP_NOTIFICATION_SETTING; +import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_OPEN_APP_SETTING; + public class EntityHeaderController { @IntDef({ActionType.ACTION_NONE, @@ -310,6 +314,9 @@ public class EntityHeaderController { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + FeatureFactory.getFactory(mAppContext).getMetricsFeatureProvider() + .actionWithSource(mAppContext, mMetricsCategory, + ACTION_OPEN_APP_NOTIFICATION_SETTING); mFragment.startActivity(mAppNotifPrefIntent); } }); @@ -327,6 +334,9 @@ public class EntityHeaderController { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + FeatureFactory.getFactory(mAppContext).getMetricsFeatureProvider() + .actionWithSource(mAppContext, mMetricsCategory, + ACTION_OPEN_APP_SETTING); mFragment.startActivity(intent); } }); diff --git a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java index 49d5e7dfb19..4294dcf11c5 100644 --- a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java +++ b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java @@ -32,11 +32,12 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; +import com.android.internal.logging.nano.MetricsProto; import com.android.settings.R; -import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.TestConfig; import com.android.settings.applications.LayoutPreference; import com.android.settings.testutils.FakeFeatureFactory; +import com.android.settings.testutils.SettingsRobolectricTestRunner; import org.junit.Before; import org.junit.Test; @@ -70,11 +71,12 @@ public class EntityHeaderControllerTest { private LayoutInflater mLayoutInflater; private PackageInfo mInfo; private EntityHeaderController mController; + private FakeFeatureFactory mFeatureFactory; @Before public void setUp() { MockitoAnnotations.initMocks(this); - FakeFeatureFactory.setupForTest(mContext); + mFeatureFactory = FakeFeatureFactory.setupForTest(mContext); mShadowContext = RuntimeEnvironment.application; when(mActivity.getApplicationContext()).thenReturn(mShadowContext); when(mContext.getApplicationContext()).thenReturn(mContext); @@ -154,6 +156,9 @@ public class EntityHeaderControllerTest { } catch (Exception e) { // Ignore exception because the launching intent is fake. } + verify(mFeatureFactory.metricsFeatureProvider).actionWithSource(mContext, + MetricsProto.MetricsEvent.VIEW_UNKNOWN, + MetricsProto.MetricsEvent.ACTION_OPEN_APP_SETTING); verify(mFragment).startActivity(any(Intent.class)); }