Skip to content

Commit 1948c53

Browse files
author
Mohit
authored
Merge branch 'dev' into mchand/proguard-rules
2 parents bab7a8b + 6ed9f94 commit 1948c53

8 files changed

Lines changed: 52 additions & 1 deletion

File tree

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
vNext
22
----------
33
- [MAJOR] Update proguard rules in common (#2756)
4+
- [MINOR] Add query parameter for Android Release OS Version (#2754)
45
- [MINOR] Add client scenario to JwtRequestBody (#2755)
56

67
Version 22.1.0

common/src/main/java/com/microsoft/identity/common/internal/platform/AndroidDeviceMetadata.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@ public String getCpu() {
7373

7474
@Override
7575
public @NonNull String getOsForMats() {
76-
return android.os.Build.VERSION.RELEASE;
76+
return getAndroidReleaseOs();
7777
}
7878

7979
@Override
8080
public @NonNull String getOsForDrs() {
81+
return getAndroidReleaseOs();
82+
}
83+
84+
@Override
85+
public @NonNull String getAndroidReleaseOs() {
8186
return android.os.Build.VERSION.RELEASE;
8287
}
8388

common4j/src/main/com/microsoft/identity/common/java/platform/Device.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,25 @@ public static String getOsForDrs() {
214214
}
215215
}
216216

217+
/**
218+
* Get the Android Release OS of this device
219+
*
220+
* @return a String representing the Android Release OS information
221+
*/
222+
@NonNull
223+
@GuardedBy("sLock")
224+
public static String getAndroidReleaseOs() {
225+
sLock.readLock().lock();
226+
try {
227+
if (sDeviceMetadata != null) {
228+
return sDeviceMetadata.getAndroidReleaseOs();
229+
}
230+
return NOT_SET;
231+
} finally {
232+
sLock.readLock().unlock();
233+
}
234+
}
235+
217236
/**
218237
* Gets the manufacturer of the current device.
219238
*

common4j/src/main/com/microsoft/identity/common/java/platform/IDeviceMetadata.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ public interface IDeviceMetadata {
6666
@NonNull
6767
String getOsForMats();
6868

69+
/**
70+
* Get the Android Release OS of this device (i.e 14, 15, 16).
71+
*
72+
* @return a String representing the Release OS information
73+
*/
74+
@NonNull
75+
String getAndroidReleaseOs();
76+
6977
/**
7078
* Get the model name of this device.
7179
*

common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/MicrosoftAuthorizationRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ public abstract class MicrosoftAuthorizationRequest<T extends MicrosoftAuthoriza
119119
@SerializedName("x-client-OS")
120120
private final String mDiagnosticOS;
121121

122+
@Expose()
123+
@Getter
124+
@Accessors(prefix = "m")
125+
@SerializedName("x-client-ReleaseOS")
126+
private final String mDiagnosticReleaseOS;
127+
122128
@Expose()
123129
@Getter
124130
@Accessors(prefix = "m")
@@ -186,9 +192,11 @@ protected MicrosoftAuthorizationRequest(@SuppressWarnings(WarningType.rawtype_wa
186192
// If the flight is enabled, set the fields
187193
if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_AM_API_WORKPROFILE_EXTRA_QUERY_PARAMETERS)) {
188194
mDiagnosticMN = Device.getManufacturer();
195+
mDiagnosticReleaseOS = Device.getAndroidReleaseOs();
189196
mWorkProfileAvailable = Device.isInPersonalProfileButClouddpcWorkProfileAvailable();
190197
} else {
191198
mDiagnosticMN = null;
199+
mDiagnosticReleaseOS = null;
192200
mWorkProfileAvailable = null;
193201
}
194202
}

common4j/src/test/com/microsoft/identity/common/java/platform/MockDeviceMetadata.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class MockDeviceMetadata extends AbstractDeviceMetadata {
3131
public static final String TEST_OS_ESTS = "TestOSEsts";
3232
public static final String TEST_OS_MATS = "TestOSMats";
3333
public static final String TEST_OS_DRS = "TestOSDrs";
34+
public static final String TEST_RELEASE_OS = "TestReleaseOS";
3435
public static final String TEST_DEVICE_MODEL = "TestDeviceModel";
3536
public static final String TEST_MANUFACTURER = "TestManufacturer";
3637

@@ -57,6 +58,11 @@ public class MockDeviceMetadata extends AbstractDeviceMetadata {
5758
return TEST_OS_DRS;
5859
}
5960

61+
@Override
62+
public @NonNull String getAndroidReleaseOs() {
63+
return TEST_RELEASE_OS;
64+
}
65+
6066
@Override
6167
public @NonNull String getDeviceModel() {
6268
return TEST_DEVICE_MODEL;

common4j/src/test/com/microsoft/identity/common/java/providers/microsoft/MicrosoftAuthorizationRequestTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void testCreateUriFromAuthorizationRequest() throws MalformedURLException
8787
"&x-client-Ver=" + MOCK_LIBRARY_VERSION +
8888
"&x-client-SKU=" + MOCK_LIBRARY_NAME +
8989
"&x-client-OS=" + MockDeviceMetadata.TEST_OS_ESTS +
90+
"&x-client-ReleaseOS=" + MockDeviceMetadata.TEST_RELEASE_OS +
9091
"&x-client-CPU=" + MockDeviceMetadata.TEST_CPU +
9192
"&x-client-DM=" + MockDeviceMetadata.TEST_DEVICE_MODEL +
9293
"&x-client-MN=" + MockDeviceMetadata.TEST_MANUFACTURER +
@@ -141,6 +142,7 @@ public void testCreateUriFromAuthorizationRequestWithWPAvailable() throws Malfor
141142
"&x-client-Ver=" + MOCK_LIBRARY_VERSION +
142143
"&x-client-SKU=" + MOCK_LIBRARY_NAME +
143144
"&x-client-OS=" + MockDeviceMetadata.TEST_OS_ESTS +
145+
"&x-client-ReleaseOS=" + MockDeviceMetadata.TEST_RELEASE_OS +
144146
"&x-client-CPU=" + MockDeviceMetadata.TEST_CPU +
145147
"&x-client-DM=" + MockDeviceMetadata.TEST_DEVICE_MODEL +
146148
"&x-client-MN=" + MockDeviceMetadata.TEST_MANUFACTURER +

common4j/src/test/com/microsoft/identity/common/java/providers/microsoft/microsoftsts/MicrosoftStsAuthorizationRequestTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public void testCreateUriFromAuthorizationRequest() throws MalformedURLException
142142
"&code_challenge=" + MOCK_PKCE_CHALLENGE.getCodeChallenge() +
143143
"&code_challenge_method=" + MOCK_PKCE_CHALLENGE.getCodeChallengeMethod() +
144144
"&x-client-OS=" + MockDeviceMetadata.TEST_OS_ESTS +
145+
"&x-client-ReleaseOS=" + MockDeviceMetadata.TEST_RELEASE_OS +
145146
"&x-client-CPU=" + MockDeviceMetadata.TEST_CPU +
146147
"&x-client-DM=" + MockDeviceMetadata.TEST_DEVICE_MODEL +
147148
"&x-client-MN=" + MockDeviceMetadata.TEST_MANUFACTURER +
@@ -220,6 +221,7 @@ public void testCreateUriFromAuthorizationRequestWithWPAvailable() throws Malfor
220221
"&code_challenge=" + MOCK_PKCE_CHALLENGE.getCodeChallenge() +
221222
"&code_challenge_method=" + MOCK_PKCE_CHALLENGE.getCodeChallengeMethod() +
222223
"&x-client-OS=" + MockDeviceMetadata.TEST_OS_ESTS +
224+
"&x-client-ReleaseOS=" + MockDeviceMetadata.TEST_RELEASE_OS +
223225
"&x-client-CPU=" + MockDeviceMetadata.TEST_CPU +
224226
"&x-client-DM=" + MockDeviceMetadata.TEST_DEVICE_MODEL +
225227
"&x-client-MN=" + MockDeviceMetadata.TEST_MANUFACTURER +

0 commit comments

Comments
 (0)