<commit_before>package org.cnodejs.android.md.storage;

import android.content.Context;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import org.cnodejs.android.md.util.codec.Digest;

import java.util.UUID;

public final class DeviceInfo {

    private DeviceInfo() {}

    private static final String TAG = "DeviceInfo";
    private static final String KEY_DEVICE_TOKEN = "deviceToken";
    private volatile static String deviceToken = null;

    public static String getDeviceToken(Context context) {
        if (TextUtils.isEmpty(deviceToken)) {
            synchronized (DeviceInfo.class) {
                if (TextUtils.isEmpty(deviceToken)) {
                    deviceToken = context.getSharedPreferences(Digest.MD5.getMessage(TAG), Context.MODE_PRIVATE).getString(KEY_DEVICE_TOKEN, null);
                }
                if (TextUtils.isEmpty(deviceToken)) {
                    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
                    if (!TextUtils.isEmpty(tm.getDeviceId())) {
                        deviceToken = Digest.MD5.getMessage(tm.getDeviceId());
                        context.getSharedPreferences(Digest.MD5.getMessage(TAG), Context.MODE_PRIVATE).edit().putString(KEY_DEVICE_TOKEN, deviceToken).apply();
                    }
                }
                if (TextUtils.isEmpty(deviceToken)) {
                    deviceToken = Digest.MD5.getMessage(UUID.randomUUID().toString());
                    context.getSharedPreferences(Digest.MD5.getMessage(TAG), Context.MODE_PRIVATE).edit().putString(KEY_DEVICE_TOKEN, deviceToken).apply();
                }
            }
        }
        return deviceToken;
    }

}<commit_msg>DeviceInfo 实现移除对 设备id的依赖<commit_after>package org.cnodejs.android.md.storage;

import android.content.Context;
import android.text.TextUtils;

import org.cnodejs.android.md.util.codec.Digest;

import java.util.UUID;

public final class DeviceInfo {

    private DeviceInfo() {}

    private static final String TAG = "DeviceInfo";
    private static final String KEY_DEVICE_TOKEN = "deviceToken";
    private volatile static String deviceToken = null;

    public static String getDeviceToken(Context context) {
        if (TextUtils.isEmpty(deviceToken)) {
            synchronized (DeviceInfo.class) {
                if (TextUtils.isEmpty(deviceToken)) {
                    deviceToken = context.getSharedPreferences(Digest.MD5.getMessage(TAG), Context.MODE_PRIVATE).getString(KEY_DEVICE_TOKEN, null);
                }
                if (TextUtils.isEmpty(deviceToken)) {
                    deviceToken = <PASSWORD>.getMessage(UUID.randomUUID().toString());
                    context.getSharedPreferences(Digest.MD5.getMessage(TAG), Context.MODE_PRIVATE).edit().putString(KEY_DEVICE_TOKEN, deviceToken).apply();
                }
            }
        }
        return deviceToken;
    }

}
{'fraction_non_alphanumeric': 0.10030601836110166, 'fraction_numerical': 0.0023801428085685142, 'mean_word_length': 2.6320987654320986, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345440', 'n_tokens_mistral': 790, 'n_tokens_neox': 790, 'n_words': 133}