Skip to content

Commit

Permalink
Revert "Added android device id to android device info (flutter#639)"
Browse files Browse the repository at this point in the history
This reverts commit b9b74ba.
  • Loading branch information
andreidiaconu authored Feb 17, 2019
1 parent 33efa0a commit b72439d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 32 deletions.
4 changes: 0 additions & 4 deletions packages/device_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 0.3.0

* Added ability to get Android ID for Android devices

## 0.2.1

* Updated Gradle tooling to match Android Studio 3.1.2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

package io.flutter.plugins.deviceinfo;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.provider.Settings;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
Expand All @@ -21,7 +18,6 @@

/** DeviceInfoPlugin */
public class DeviceInfoPlugin implements MethodCallHandler {
private final Context context;

/** Substitute for missing values. */
private static final String[] EMPTY_STRING_LIST = new String[] {};
Expand All @@ -30,13 +26,11 @@ public class DeviceInfoPlugin implements MethodCallHandler {
public static void registerWith(Registrar registrar) {
final MethodChannel channel =
new MethodChannel(registrar.messenger(), "plugins.flutter.io/device_info");
channel.setMethodCallHandler(new DeviceInfoPlugin(registrar.activity()));
channel.setMethodCallHandler(new DeviceInfoPlugin());
}

/** Do not allow direct instantiation. */
private DeviceInfoPlugin(Context context) {
this.context = context;
}
private DeviceInfoPlugin() {}

@Override
public void onMethodCall(MethodCall call, Result result) {
Expand Down Expand Up @@ -66,7 +60,6 @@ public void onMethodCall(MethodCall call, Result result) {
build.put("tags", Build.TAGS);
build.put("type", Build.TYPE);
build.put("isPhysicalDevice", !isEmulator());
build.put("androidId", getAndroidId());

Map<String, Object> version = new HashMap<>();
if (VERSION.SDK_INT >= VERSION_CODES.M) {
Expand All @@ -86,18 +79,6 @@ public void onMethodCall(MethodCall call, Result result) {
}
}

/**
* Returns the Android hardware device ID that is unique between the device + user and app
* signing. This key will change if the app is uninstalled or its data is cleared. Device factory
* reset will also result in a value change.
*
* @return The android ID
*/
@SuppressLint("HardwareIds")
private String getAndroidId() {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}

/**
* A simple emulator-detection based on the flutter tools detection logic and a couple of legacy
* detection systems
Expand Down
1 change: 0 additions & 1 deletion packages/device_info/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class _MyAppState extends State<MyApp> {
'tags': build.tags,
'type': build.type,
'isPhysicalDevice': build.isPhysicalDevice,
'androidId': build.androidId,
};
}

Expand Down
5 changes: 0 additions & 5 deletions packages/device_info/lib/device_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class AndroidDeviceInfo {
this.tags,
this.type,
this.isPhysicalDevice,
this.androidId,
}) : supported32BitAbis = List<String>.unmodifiable(supported32BitAbis),
supported64BitAbis = List<String>.unmodifiable(supported64BitAbis),
supportedAbis = List<String>.unmodifiable(supportedAbis);
Expand Down Expand Up @@ -120,9 +119,6 @@ class AndroidDeviceInfo {
/// `false` if the application is running in an emulator, `true` otherwise.
final bool isPhysicalDevice;

/// The Android hardware device ID that is unique between the device + user and app signing.
final String androidId;

/// Deserializes from the message received from [_kChannel].
static AndroidDeviceInfo _fromMap(dynamic message) {
final Map<dynamic, dynamic> map = message;
Expand All @@ -146,7 +142,6 @@ class AndroidDeviceInfo {
tags: map['tags'],
type: map['type'],
isPhysicalDevice: map['isPhysicalDevice'],
androidId: map['androidId'],
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/device_info/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin providing detailed information about the device
(make, model, etc.), and Android or iOS version the app is running on.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/device_info
version: 0.3.0
version: 0.2.1

flutter:
plugin:
Expand Down

0 comments on commit b72439d

Please sign in to comment.