Add logging when entity header buttons are clicked
Change-Id: I673e5b4a6c5f8736bbec72e259a82acb3f514828 Fix: 62709062 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -8959,7 +8959,7 @@
|
|||||||
<string name="help_url_audio_accessory_not_supported" translatable="false"></string>
|
<string name="help_url_audio_accessory_not_supported" translatable="false"></string>
|
||||||
|
|
||||||
<!-- Title label for new device suggestion, which is displayed in Settings homepage [CHAR LIMIT=100] -->
|
<!-- Title label for new device suggestion, which is displayed in Settings homepage [CHAR LIMIT=100] -->
|
||||||
<string name="new_device_suggestion_title">What's new and exciting?</string>
|
<string name="new_device_suggestion_title">What\'s new and exciting?</string>
|
||||||
|
|
||||||
<!-- Summary label for new device suggestion, which is displayed in Settings homepage [CHAR LIMIT=100] -->
|
<!-- Summary label for new device suggestion, which is displayed in Settings homepage [CHAR LIMIT=100] -->
|
||||||
<string name="new_device_suggestion_summary">Check out the top 5 features</string>
|
<string name="new_device_suggestion_summary">Check out the top 5 features</string>
|
||||||
|
@@ -52,6 +52,10 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
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 {
|
public class EntityHeaderController {
|
||||||
|
|
||||||
@IntDef({ActionType.ACTION_NONE,
|
@IntDef({ActionType.ACTION_NONE,
|
||||||
@@ -310,6 +314,9 @@ public class EntityHeaderController {
|
|||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
FeatureFactory.getFactory(mAppContext).getMetricsFeatureProvider()
|
||||||
|
.actionWithSource(mAppContext, mMetricsCategory,
|
||||||
|
ACTION_OPEN_APP_NOTIFICATION_SETTING);
|
||||||
mFragment.startActivity(mAppNotifPrefIntent);
|
mFragment.startActivity(mAppNotifPrefIntent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -327,6 +334,9 @@ public class EntityHeaderController {
|
|||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
FeatureFactory.getFactory(mAppContext).getMetricsFeatureProvider()
|
||||||
|
.actionWithSource(mAppContext, mMetricsCategory,
|
||||||
|
ACTION_OPEN_APP_SETTING);
|
||||||
mFragment.startActivity(intent);
|
mFragment.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -32,11 +32,12 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.internal.logging.nano.MetricsProto;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
|
||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
import com.android.settings.applications.LayoutPreference;
|
import com.android.settings.applications.LayoutPreference;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -70,11 +71,12 @@ public class EntityHeaderControllerTest {
|
|||||||
private LayoutInflater mLayoutInflater;
|
private LayoutInflater mLayoutInflater;
|
||||||
private PackageInfo mInfo;
|
private PackageInfo mInfo;
|
||||||
private EntityHeaderController mController;
|
private EntityHeaderController mController;
|
||||||
|
private FakeFeatureFactory mFeatureFactory;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
FakeFeatureFactory.setupForTest(mContext);
|
mFeatureFactory = FakeFeatureFactory.setupForTest(mContext);
|
||||||
mShadowContext = RuntimeEnvironment.application;
|
mShadowContext = RuntimeEnvironment.application;
|
||||||
when(mActivity.getApplicationContext()).thenReturn(mShadowContext);
|
when(mActivity.getApplicationContext()).thenReturn(mShadowContext);
|
||||||
when(mContext.getApplicationContext()).thenReturn(mContext);
|
when(mContext.getApplicationContext()).thenReturn(mContext);
|
||||||
@@ -154,6 +156,9 @@ public class EntityHeaderControllerTest {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignore exception because the launching intent is fake.
|
// 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));
|
verify(mFragment).startActivity(any(Intent.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user