Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5776,6 +5776,7 @@ package android.app.admin { method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy(); method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName); method public android.os.Bundle getUserRestrictions(android.content.ComponentName); method public java.lang.String getWifiMacAddress(); method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]); method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean installCaCert(android.content.ComponentName, byte[]); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5906,6 +5906,7 @@ package android.app.admin { method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy(); method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName); method public android.os.Bundle getUserRestrictions(android.content.ComponentName); method public java.lang.String getWifiMacAddress(); method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]); method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean installCaCert(android.content.ComponentName, byte[]); core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -4649,4 +4649,21 @@ public class DevicePolicyManager { return false; } } /** * Called by device owner to get the MAC address of the Wi-Fi device. * * @return the MAC address of the Wi-Fi device, or null when the information is not * available. (For example, Wi-Fi hasn't been enabled, or the device doesn't support Wi-Fi.) * * <p>The address will be in the {@code XX:XX:XX:XX:XX:XX} format. */ public String getWifiMacAddress() { try { return mService.getWifiMacAddress(); } catch (RemoteException re) { Log.w(TAG, "Failed talking with device policy service", re); return null; } } } core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -236,4 +236,5 @@ interface IDevicePolicyManager { List<String> getKeepUninstalledPackages(in ComponentName admin); boolean isManagedProfile(in ComponentName admin); boolean isSystemOnlyUser(in ComponentName admin); String getWifiMacAddress(); } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ import android.media.IAudioService; import android.net.ConnectivityManager; import android.net.ProxyInfo; import android.net.Uri; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -1121,6 +1123,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return Looper.myLooper(); } WifiManager getWifiManager() { return mContext.getSystemService(WifiManager.class); } long binderClearCallingIdentity() { return Binder.clearCallingIdentity(); } Loading Loading @@ -6871,6 +6877,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return true; } @Override public String getWifiMacAddress() { // Make sure caller has DO. synchronized (this) { getActiveAdminForCallerLocked(null, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); } final long ident = mInjector.binderClearCallingIdentity(); try { final WifiInfo wifiInfo = mInjector.getWifiManager().getConnectionInfo(); if (wifiInfo == null) { return null; } return wifiInfo.hasRealMacAddress() ? wifiInfo.getMacAddress() : null; } finally { mInjector.binderRestoreCallingIdentity(ident); } } /** * Returns the target sdk version number that the given packageName was built for * in the given user. Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5776,6 +5776,7 @@ package android.app.admin { method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy(); method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName); method public android.os.Bundle getUserRestrictions(android.content.ComponentName); method public java.lang.String getWifiMacAddress(); method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]); method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean installCaCert(android.content.ComponentName, byte[]);
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5906,6 +5906,7 @@ package android.app.admin { method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy(); method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName); method public android.os.Bundle getUserRestrictions(android.content.ComponentName); method public java.lang.String getWifiMacAddress(); method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]); method public boolean hasGrantedPolicy(android.content.ComponentName, int); method public boolean installCaCert(android.content.ComponentName, byte[]);
core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -4649,4 +4649,21 @@ public class DevicePolicyManager { return false; } } /** * Called by device owner to get the MAC address of the Wi-Fi device. * * @return the MAC address of the Wi-Fi device, or null when the information is not * available. (For example, Wi-Fi hasn't been enabled, or the device doesn't support Wi-Fi.) * * <p>The address will be in the {@code XX:XX:XX:XX:XX:XX} format. */ public String getWifiMacAddress() { try { return mService.getWifiMacAddress(); } catch (RemoteException re) { Log.w(TAG, "Failed talking with device policy service", re); return null; } } }
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -236,4 +236,5 @@ interface IDevicePolicyManager { List<String> getKeepUninstalledPackages(in ComponentName admin); boolean isManagedProfile(in ComponentName admin); boolean isSystemOnlyUser(in ComponentName admin); String getWifiMacAddress(); }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ import android.media.IAudioService; import android.net.ConnectivityManager; import android.net.ProxyInfo; import android.net.Uri; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -1121,6 +1123,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return Looper.myLooper(); } WifiManager getWifiManager() { return mContext.getSystemService(WifiManager.class); } long binderClearCallingIdentity() { return Binder.clearCallingIdentity(); } Loading Loading @@ -6871,6 +6877,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return true; } @Override public String getWifiMacAddress() { // Make sure caller has DO. synchronized (this) { getActiveAdminForCallerLocked(null, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); } final long ident = mInjector.binderClearCallingIdentity(); try { final WifiInfo wifiInfo = mInjector.getWifiManager().getConnectionInfo(); if (wifiInfo == null) { return null; } return wifiInfo.hasRealMacAddress() ? wifiInfo.getMacAddress() : null; } finally { mInjector.binderRestoreCallingIdentity(ident); } } /** * Returns the target sdk version number that the given packageName was built for * in the given user. Loading