Add logging for settings

- Log when navigating from Settings to injected tiles.
- Log when user creates a new widget shortcut

Fix: 33209678
Fix: 30137094
Test: RunSettingsRoboTests
Change-Id: I1e0f4e00709c392cde2550fafe53890836387c99
This commit is contained in:
Fan Zhang
2017-02-13 15:28:21 -08:00
parent 628b3cb76e
commit 42aaa53e75
4 changed files with 44 additions and 5 deletions

View File

@@ -39,7 +39,9 @@ import android.view.View.MeasureSpec;
import android.widget.ImageView;
import android.widget.ListView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.Settings.TetherSettingsActivity;
import com.android.settings.overlay.FeatureFactory;
import java.util.ArrayList;
import java.util.List;
@@ -56,7 +58,8 @@ public class CreateShortcut extends LauncherActivity {
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
ListItem item = itemForPosition(position);
final ListItem item = itemForPosition(position);
logCreateShortcut(item.resolveInfo);
setResult(RESULT_OK, createResultIntent(intentForPosition(position),
item.resolveInfo, item.label));
finish();
@@ -89,6 +92,15 @@ public class CreateShortcut extends LauncherActivity {
return intent;
}
private void logCreateShortcut(ResolveInfo info) {
if (info == null || info.activityInfo == null) {
return;
}
FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(
this, MetricsProto.MetricsEvent.ACTION_SETTINGS_CREATE_SHORTCUT,
info.activityInfo.name);
}
private Bitmap createIcon(int resource) {
Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material);
View view = LayoutInflater.from(context).inflate(R.layout.shortcut_badge, null);
@@ -165,7 +177,7 @@ public class CreateShortcut extends LauncherActivity {
continue;
}
updates.add(new ShortcutInfo.Builder(mContext, info.getId())
.setShortLabel(ri.loadLabel(pm)).build());
.setShortLabel(ri.loadLabel(pm)).build());
}
if (!updates.isEmpty()) {
sm.updateShortcuts(updates);