Skip to content

Commit

Permalink
update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailSuendukov committed Nov 28, 2023
1 parent f302029 commit 201896a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Version 5.0.3 (In development)

### App Center Distribute

* **[Fix]** Add RECEIVER_EXPORTED flag for install receiver
* **[Fix]** Add FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT flag for broadcast pending intent

## Version 5.0.2

### AppCenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class InstallStatusReceiver extends BroadcastReceiver {
static final String INSTALL_STATUS_ACTION = "com.microsoft.appcenter.action.INSTALL_STATUS";

/**
* Raw value of PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT which will appear only in
* Android target SDK 34.
* Raw value of PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
* https://developer.android.com/reference/android/app/PendingIntent#FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
* which will appear only in Android target SDK 34.
*/
@VisibleForTesting
private static final int FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT_VALUE = 16777216;
Expand All @@ -54,7 +55,7 @@ static IntentFilter getInstallerReceiverFilter() {
* @param requestCode request code for the sender.
* @return IntentSender with receiver.
*/
static IntentSender getInstallStatusIntentSender(Context context, int requestCode) throws NoSuchFieldException, IllegalAccessException {
static IntentSender getInstallStatusIntentSender(Context context, int requestCode) {
int broadcastFlags = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
broadcastFlags = PendingIntent.FLAG_MUTABLE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private synchronized void startInstallSession(@NonNull Uri localUri) {
IntentSender statusReceiver = InstallStatusReceiver.getInstallStatusIntentSender(mContext, mSessionId);
session.commit(statusReceiver);
session.close();
} catch (IOException | RuntimeException | NoSuchFieldException | IllegalAccessException e) {
} catch (IOException | RuntimeException e) {
if (session != null) {
session.abandon();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,30 @@ public void installerReceiverFilter() throws Exception {
}

@Test
public void createIntentSenderOnAndroid34() throws NoSuchFieldException, IllegalAccessException {
public void createIntentSenderOnAndroid34() {

/* Mock SDK_INT to 34 target SDK. */
Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", 34);
createIntentSender(PendingIntent.FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT_VALUE);
}

@Test
public void createIntentSenderOnAndroidS() throws NoSuchFieldException, IllegalAccessException {
public void createIntentSenderOnAndroidS() {

/* Mock SDK_INT to S. */
Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.S);
createIntentSender(PendingIntent.FLAG_MUTABLE);
}

@Test
public void createIntentSenderOnAndroidLowS() throws NoSuchFieldException, IllegalAccessException {
public void createIntentSenderOnAndroidLowS() {

/* Mock SDK_INT to M. */
Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.M);
createIntentSender(0);
}

private void createIntentSender(int expectedFlag) throws NoSuchFieldException, IllegalAccessException {
private void createIntentSender(int expectedFlag) {
mockStatic(PendingIntent.class);
PendingIntent intent = mock(PendingIntent.class);
IntentSender sender = mock(IntentSender.class);
Expand Down

0 comments on commit 201896a

Please sign in to comment.