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

Commit 5d1e0a77 authored by chayemme's avatar chayemme Committed by chaneswar yemme
Browse files

Skip reSetOrganizationId_throws and enrollmentSpecificId_CorrectlyCalculated...

Skip reSetOrganizationId_throws and enrollmentSpecificId_CorrectlyCalculated tests if wifi feature not supported

Test case reSetOrganizationId_throws and  enrollmentSpecificId_CorrectlyCalculated accessing the wifimanager and leads to crash.

Bug: 351018045
Change-Id: I381cead3dedaa8ba46258c571da188735db47b4f
parent 295e98dd
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;
@@ -66,14 +67,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);