VancedMicroG/play-services-core/src/main/java/org/microg/gms/common/Build.java

57 lines
2.1 KiB
Java
Raw Normal View History

2015-02-01 22:27:46 +00:00
/*
* Copyright (C) 2013-2017 microG Project Team
2015-02-01 22:27:46 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2015-02-03 22:08:55 +00:00
package org.microg.gms.common;
2015-02-01 22:27:46 +00:00
2015-08-06 15:38:46 +00:00
import java.util.Locale;
2015-07-08 16:23:20 +00:00
import java.util.Random;
2015-02-03 22:08:55 +00:00
public class Build {
2015-02-19 00:29:43 +00:00
public String fingerprint = android.os.Build.FINGERPRINT;
public String hardware = android.os.Build.HARDWARE;
public String brand = android.os.Build.BRAND;
public String radio = getRadio();
public String bootloader = android.os.Build.BOOTLOADER;
public long time = android.os.Build.TIME;
public String device = android.os.Build.DEVICE;
2015-02-03 22:08:55 +00:00
public int sdk = android.os.Build.VERSION.SDK_INT;
2015-02-19 00:29:43 +00:00
public String model = android.os.Build.MODEL;
public String manufacturer = android.os.Build.MANUFACTURER;
public String product = android.os.Build.PRODUCT;
2015-02-03 22:08:55 +00:00
public String id = android.os.Build.ID;
2015-07-08 16:23:20 +00:00
public String serial = generateSerialNumber(); // TODO: static
2015-02-19 00:29:43 +00:00
2015-08-06 15:38:46 +00:00
@SuppressWarnings("deprecation")
2015-02-19 00:29:43 +00:00
private static String getRadio() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return android.os.Build.getRadioVersion();
} else {
return android.os.Build.RADIO;
}
}
2015-07-08 16:23:20 +00:00
private String generateSerialNumber() {
2020-08-31 23:34:24 +00:00
String serial;
2015-07-08 16:23:20 +00:00
Random rand = new Random();
2020-08-31 23:34:24 +00:00
StringBuilder serialBuilder = new StringBuilder("008741");
2015-07-08 16:23:20 +00:00
for (int i = 0; i < 10; i++)
2020-08-31 23:34:24 +00:00
serialBuilder.append(Integer.toString(rand.nextInt(16), 16));
serial = serialBuilder.toString();
2015-08-06 15:38:46 +00:00
serial = serial.toUpperCase(Locale.US);
2015-07-08 16:23:20 +00:00
return serial;
}
2015-02-01 22:27:46 +00:00
}