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

Commit d55c4749 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

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



Change-Id: Ieb0c51f832227a96268115c18742a44df2b75ea2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 341d3e6f 1ba915c1
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);