Skip to content

Commit deaae75

Browse files
authored
refactor(android)!: Remove unused code (#183)
1 parent fbf9d30 commit deaae75

File tree

1 file changed

+10
-49
lines changed

1 file changed

+10
-49
lines changed

src/android/Device.java

+10-49
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Licensed to the Apache Software Foundation (ASF) under one
1818
*/
1919
package org.apache.cordova.device;
2020

21-
import java.util.TimeZone;
22-
2321
import org.apache.cordova.CordovaWebView;
2422
import org.apache.cordova.CallbackContext;
2523
import org.apache.cordova.CordovaPlugin;
@@ -31,14 +29,10 @@ Licensed to the Apache Software Foundation (ASF) under one
3129
import android.provider.Settings;
3230

3331
public class Device extends CordovaPlugin {
34-
public static final String TAG = "Device";
3532

36-
public static String platform; // Device OS
3733
public static String uuid; // Device UUID
3834

3935
private static final String ANDROID_PLATFORM = "Android";
40-
private static final String AMAZON_PLATFORM = "amazon-fireos";
41-
private static final String AMAZON_DEVICE = "Amazon";
4236

4337
/**
4438
* Constructor.
@@ -62,7 +56,7 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
6256
* Executes the request and returns PluginResult.
6357
*
6458
* @param action The action to execute.
65-
* @param args JSONArry of arguments for the plugin.
59+
* @param args JSONArray of arguments for the plugin.
6660
* @param callbackContext The callback id used when calling back into JavaScript.
6761
* @return True if the action was valid, false if not.
6862
*/
@@ -92,79 +86,46 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
9286
/**
9387
* Get the OS name.
9488
*
95-
* @return
89+
* @return "Android"
9690
*/
9791
public String getPlatform() {
98-
String platform;
99-
if (isAmazonDevice()) {
100-
platform = AMAZON_PLATFORM;
101-
} else {
102-
platform = ANDROID_PLATFORM;
103-
}
104-
return platform;
92+
return ANDROID_PLATFORM;
10593
}
10694

10795
/**
10896
* Get the device's Universally Unique Identifier (UUID).
10997
*
110-
* @return
98+
* @return android.provider.Settings.Secure.ANDROID_ID
11199
*/
112100
public String getUuid() {
113-
String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
114-
return uuid;
101+
return Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
115102
}
116103

117104
public String getModel() {
118-
String model = android.os.Build.MODEL;
119-
return model;
120-
}
121-
122-
public String getProductName() {
123-
String productname = android.os.Build.PRODUCT;
124-
return productname;
105+
return android.os.Build.MODEL;
125106
}
126107

127108
public String getManufacturer() {
128-
String manufacturer = android.os.Build.MANUFACTURER;
129-
return manufacturer;
109+
return android.os.Build.MANUFACTURER;
130110
}
131111

132112
public String getSerialNumber() {
133-
String serial = android.os.Build.SERIAL;
134-
return serial;
113+
return android.os.Build.SERIAL;
135114
}
136115

137116
/**
138117
* Get the OS version.
139118
*
140-
* @return
119+
* @return android.os.Build.VERSION.RELEASE
141120
*/
142121
public String getOSVersion() {
143-
String osversion = android.os.Build.VERSION.RELEASE;
144-
return osversion;
122+
return android.os.Build.VERSION.RELEASE;
145123
}
146124

147125
public String getSDKVersion() {
148126
return String.valueOf(android.os.Build.VERSION.SDK_INT);
149127
}
150128

151-
public String getTimeZoneID() {
152-
TimeZone tz = TimeZone.getDefault();
153-
return (tz.getID());
154-
}
155-
156-
/**
157-
* Function to check if the device is manufactured by Amazon
158-
*
159-
* @return
160-
*/
161-
public boolean isAmazonDevice() {
162-
if (android.os.Build.MANUFACTURER.equals(AMAZON_DEVICE)) {
163-
return true;
164-
}
165-
return false;
166-
}
167-
168129
public boolean isVirtual() {
169130
return android.os.Build.FINGERPRINT.contains("generic") ||
170131
android.os.Build.PRODUCT.contains("sdk");

0 commit comments

Comments
 (0)