Update system APIs based on feedback.

API council has requested that the recently added BroadcastOptions
APIs be modified to better match API guidelines.

Bug: 267646347
Test: treehugger
Change-Id: Ia701ae31079476d0cc05079d62cd90ba81279cdd
This commit is contained in:
Jeff Sharkey
2023-03-06 14:10:30 -07:00
parent dd4cecc907
commit 4ffd34cc42
3 changed files with 5 additions and 3 deletions

View File

@@ -537,7 +537,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
BroadcastOptions.makeBasic()) BroadcastOptions.makeBasic())
.setDeliveryGroupPolicy( .setDeliveryGroupPolicy(
ConstantsShim.DELIVERY_GROUP_POLICY_MOST_RECENT) ConstantsShim.DELIVERY_GROUP_POLICY_MOST_RECENT)
.setDeferUntilActive(true) .setDeferralPolicy(
ConstantsShim.DEFERRAL_POLICY_UNTIL_ACTIVE)
.toBundle(); .toBundle();
} catch (UnsupportedApiLevelException e) { } catch (UnsupportedApiLevelException e) {
Log.wtf(TAG, "Using unsupported API" + e); Log.wtf(TAG, "Using unsupported API" + e);

View File

@@ -3133,7 +3133,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
optsShim.setDeliveryGroupPolicy(ConstantsShim.DELIVERY_GROUP_POLICY_MOST_RECENT); optsShim.setDeliveryGroupPolicy(ConstantsShim.DELIVERY_GROUP_POLICY_MOST_RECENT);
optsShim.setDeliveryGroupMatchingKey(ConnectivityManager.CONNECTIVITY_ACTION, optsShim.setDeliveryGroupMatchingKey(ConnectivityManager.CONNECTIVITY_ACTION,
createDeliveryGroupKeyForConnectivityAction(info)); createDeliveryGroupKeyForConnectivityAction(info));
optsShim.setDeferUntilActive(true); optsShim.setDeferralPolicy(ConstantsShim.DEFERRAL_POLICY_UNTIL_ACTIVE);
} catch (UnsupportedApiLevelException e) { } catch (UnsupportedApiLevelException e) {
Log.wtf(TAG, "Using unsupported API" + e); Log.wtf(TAG, "Using unsupported API" + e);
} }

View File

@@ -864,7 +864,8 @@ public class ConnectivityServiceTest {
verify(mBroadcastOptionsShim).setDeliveryGroupMatchingKey( verify(mBroadcastOptionsShim).setDeliveryGroupMatchingKey(
eq(CONNECTIVITY_ACTION), eq(CONNECTIVITY_ACTION),
eq(createDeliveryGroupKeyForConnectivityAction(ni))); eq(createDeliveryGroupKeyForConnectivityAction(ni)));
verify(mBroadcastOptionsShim).setDeferUntilActive(eq(true)); verify(mBroadcastOptionsShim).setDeferralPolicy(
eq(ConstantsShim.DEFERRAL_POLICY_UNTIL_ACTIVE));
} catch (UnsupportedApiLevelException e) { } catch (UnsupportedApiLevelException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }