limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to show Device Id -->
+ <plurals name="show_device_id_countdown_cm">
+ <item quantity="one">You are now <xliff:g id="step_count">%1$d</xliff:g> step away from querying Device ID.</item>
+ <item quantity="other">You are now <xliff:g id="step_count">%1$d</xliff:g> steps away from querying Device ID.</item>
+ </plurals>
+ <!-- Device Info screen. Confirmation that Device ID is copied to clipboard -->
+ <string name="show_device_id_copied_cm">Device ID:[<xliff:g id="device_id">%1$s</xliff:g>] copied to clipboard</string>
+ <!-- Device Info screen. Confirmation that Device ID is not available -->
+ <string name="show_device_id_failed_cm">Device ID is not available on this build</string>
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Label for the deviceID text put to clipboard -->
+ <string name="show_device_id_clipboard_label">Device ID</string>
+
<!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings -->
<plurals name="show_dev_countdown_cm">
<item quantity="one">You are now <xliff:g id="step_count">%1$d</xliff:g> step away from enabling development settings.</item>
package com.android.settings;
import android.app.Activity;
+import android.content.ClipData;
+import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.util.Log;
import android.widget.Toast;
+import cyanogenmod.hardware.CMHardwareManager;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Index;
private static final String KEY_CM_UPDATES = "cm_updates";
static final int TAPS_TO_BE_A_DEVELOPER = 7;
+ static final int TAPS_TO_SHOW_DEVICEID = 7;
long[] mHits = new long[3];
int mDevHitCountdown;
+ int mDevIdCountdown;
Toast mDevHitToast;
+ Toast mDevIdToast;
@Override
protected int getMetricsCategory() {
setStringSummary(KEY_DEVICE_MODEL, Build.MODEL);
setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY);
findPreference(KEY_BUILD_NUMBER).setEnabled(true);
- findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
+
+ final Preference kernelPref = findPreference(KEY_KERNEL_VERSION);
+ kernelPref.setEnabled(true);
+ kernelPref.setSummary(getFormattedKernelVersion());
findPreference(KEY_MOD_VERSION).setSummary(
cyanogenmod.os.Build.CYANOGENMOD_DISPLAY_VERSION);
findPreference(KEY_MOD_VERSION).setEnabled(true);
Context.MODE_PRIVATE).getBoolean(DevelopmentSettings.PREF_SHOW,
android.os.Build.TYPE.equals("eng")) ? -1 : TAPS_TO_BE_A_DEVELOPER;
mDevHitToast = null;
+ mDevIdCountdown = TAPS_TO_SHOW_DEVICEID;
+ mDevIdToast = null;
}
@Override
Log.e(LOG_TAG, "Unable to start activity " + intent.toString());
}
}
+ } else if (preference.getKey().equals(KEY_KERNEL_VERSION)) {
+
+ mDevIdCountdown --;
+ if (mDevIdCountdown == 0) {
+ final CMHardwareManager hwMgr = CMHardwareManager.getInstance(getActivity().getApplicationContext());
+ final String deviceID = hwMgr.getUniqueDeviceId();
+ CharSequence msg;
+ if (deviceID == null) {
+ msg = getText(R.string.show_device_id_failed_cm);
+ }
+ else {
+ final ClipboardManager clipboardMgr = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
+ clipboardMgr.setPrimaryClip(ClipData.newPlainText(getResources().
+ getString(R.string.show_device_id_clipboard_label),
+ deviceID));
+ msg = getResources().getString(
+ R.string.show_device_id_copied_cm, deviceID);
+ }
+
+ mDevIdToast = Toast.makeText(getActivity(), msg,
+ Toast.LENGTH_LONG);
+ mDevIdToast.show();
+ mDevIdCountdown = TAPS_TO_SHOW_DEVICEID;
+ }
+ else if (mDevIdCountdown > 0
+ && mDevIdCountdown < (TAPS_TO_SHOW_DEVICEID-2)) {
+
+ if (mDevIdToast != null) {
+ mDevIdToast.cancel();
+ }
+ mDevIdToast = Toast.makeText(getActivity(), getResources().getQuantityString(
+ R.plurals.show_device_id_countdown_cm, mDevIdCountdown, mDevIdCountdown),
+ Toast.LENGTH_SHORT);
+ mDevIdToast.show();
+ }
+
} else if (preference.getKey().equals(KEY_BUILD_NUMBER)) {
// Don't enable developer options for secondary users.
if (UserHandle.myUserId() != UserHandle.USER_OWNER) return true;