Logs Flash Notifications toggle event
Logs the toggle event of different kind of flash notification to better know about how many usage of these feature and make it as our success metrics. Bug: 277552681 Test: m statsd_testdrive && statsd_testdrive 513, checks the metrics manually Change-Id: I73068744b7eef391ee459314da21c23cf64ef212
This commit is contained in:
@@ -24,7 +24,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for Camera flash notification.
|
* Controller for Camera flash notification.
|
||||||
@@ -49,6 +49,8 @@ public class CameraFlashNotificationPreferenceController extends TogglePreferenc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setChecked(boolean isChecked) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
|
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider().changed(
|
||||||
|
getMetricsCategory(), getPreferenceKey(), isChecked ? 1 : 0);
|
||||||
return Settings.System.putInt(mContext.getContentResolver(),
|
return Settings.System.putInt(mContext.getContentResolver(),
|
||||||
Settings.System.CAMERA_FLASH_NOTIFICATION, (isChecked ? ON : OFF));
|
Settings.System.CAMERA_FLASH_NOTIFICATION, (isChecked ? ON : OFF));
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@@ -62,8 +63,11 @@ public class ScreenFlashNotificationPreferenceController extends TogglePreferenc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setChecked(boolean isChecked) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
if (isChecked) checkAndSetInitialColor();
|
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider().changed(
|
||||||
|
getMetricsCategory(), getPreferenceKey(), isChecked ? 1 : 0);
|
||||||
|
if (isChecked) {
|
||||||
|
checkAndSetInitialColor();
|
||||||
|
}
|
||||||
return Settings.System.putInt(mContext.getContentResolver(),
|
return Settings.System.putInt(mContext.getContentResolver(),
|
||||||
Settings.System.SCREEN_FLASH_NOTIFICATION, (isChecked ? ON : OFF));
|
Settings.System.SCREEN_FLASH_NOTIFICATION, (isChecked ? ON : OFF));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user