Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 694fc6c6 authored by Elis Elliott's avatar Elis Elliott Committed by Automerger Merge Worker
Browse files

Merge "Skip reSetOrganizationId_throws and...

Merge "Skip reSetOrganizationId_throws and enrollmentSpecificId_CorrectlyCalculated tests if wifi feature not supported" into main am: 1ba915c1 am: d55c4749

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3165187



Change-Id: Iee36c12f8719bd647ee232c44d28ee175d67a2d3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b8f77af1 d55c4749
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.devicepolicy;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.VerifierDeviceIdentity;
import android.net.wifi.WifiManager;
import android.os.Build;
@@ -77,14 +78,15 @@ class EnterpriseSpecificIdCalculator {
        mMeid = meid;
        mSerialNumber = Build.getSerial();
        WifiManager wifiManager = context.getSystemService(WifiManager.class);
        Preconditions.checkState(wifiManager != null, "Unable to access WiFi service");
        String macAddress = "";
        if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
            final String[] macAddresses = wifiManager.getFactoryMacAddresses();
        if (macAddresses == null || macAddresses.length == 0) {
            mMacAddress = "";
        } else {
            mMacAddress = macAddresses[0];
            if (macAddresses != null && macAddresses.length > 0) {
                macAddress = macAddresses[0];
            }
        }
        mMacAddress = macAddress;
    }

    private static String getPaddedTruncatedString(String input, int maxLength) {
        final String paddedValue = String.format("%" + maxLength + "s", input);