Merge "Move displaying mag bounds into surface transation" into oc-dev
diff --git a/api/current.txt b/api/current.txt
index 9b6227f..6234168 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26675,7 +26675,6 @@
ctor public PublishConfig.Builder();
method public android.net.wifi.aware.PublishConfig build();
method public android.net.wifi.aware.PublishConfig.Builder setMatchFilter(java.util.List<byte[]>);
- method public android.net.wifi.aware.PublishConfig.Builder setPublishCount(int);
method public android.net.wifi.aware.PublishConfig.Builder setPublishType(int);
method public android.net.wifi.aware.PublishConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.PublishConfig.Builder setServiceSpecificInfo(byte[]);
@@ -26704,7 +26703,6 @@
method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]);
- method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeCount(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setTerminateNotificationEnabled(boolean);
method public android.net.wifi.aware.SubscribeConfig.Builder setTtlSec(int);
diff --git a/api/system-current.txt b/api/system-current.txt
index 515cf97..6a6b279 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -29367,7 +29367,6 @@
ctor public PublishConfig.Builder();
method public android.net.wifi.aware.PublishConfig build();
method public android.net.wifi.aware.PublishConfig.Builder setMatchFilter(java.util.List<byte[]>);
- method public android.net.wifi.aware.PublishConfig.Builder setPublishCount(int);
method public android.net.wifi.aware.PublishConfig.Builder setPublishType(int);
method public android.net.wifi.aware.PublishConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.PublishConfig.Builder setServiceSpecificInfo(byte[]);
@@ -29396,7 +29395,6 @@
method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]);
- method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeCount(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setTerminateNotificationEnabled(boolean);
method public android.net.wifi.aware.SubscribeConfig.Builder setTtlSec(int);
diff --git a/api/test-current.txt b/api/test-current.txt
index 051e2e6..1f342e6 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -26788,7 +26788,6 @@
ctor public PublishConfig.Builder();
method public android.net.wifi.aware.PublishConfig build();
method public android.net.wifi.aware.PublishConfig.Builder setMatchFilter(java.util.List<byte[]>);
- method public android.net.wifi.aware.PublishConfig.Builder setPublishCount(int);
method public android.net.wifi.aware.PublishConfig.Builder setPublishType(int);
method public android.net.wifi.aware.PublishConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.PublishConfig.Builder setServiceSpecificInfo(byte[]);
@@ -26817,7 +26816,6 @@
method public android.net.wifi.aware.SubscribeConfig.Builder setMatchStyle(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(java.lang.String);
method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(byte[]);
- method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeCount(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int);
method public android.net.wifi.aware.SubscribeConfig.Builder setTerminateNotificationEnabled(boolean);
method public android.net.wifi.aware.SubscribeConfig.Builder setTtlSec(int);
diff --git a/packages/SystemUI/res/layout/recents_incompatible_app_overlay.xml b/packages/SystemUI/res/layout/recents_incompatible_app_overlay.xml
index d2daa89..a1c1e5b 100644
--- a/packages/SystemUI/res/layout/recents_incompatible_app_overlay.xml
+++ b/packages/SystemUI/res/layout/recents_incompatible_app_overlay.xml
@@ -26,6 +26,6 @@
android:layout_gravity="center"
android:drawableTop="@drawable/recents_info_light"
android:drawablePadding="8dp"
- android:text="@string/recents_incompatible_app_message"
+ android:text="@string/dock_non_resizeble_failed_to_dock_text"
android:textColor="@android:color/white" />
</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 0c0bdeb..a2ec804 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -789,8 +789,6 @@
<string name="recents_launch_disabled_message"><xliff:g id="app" example="Calendar">%s</xliff:g> is disabled in safe-mode.</string>
<!-- Recents: Stack action button string. [CHAR LIMIT=NONE] -->
<string name="recents_stack_action_button_label">Clear all</string>
- <!-- Recents: Incompatible task message. [CHAR LIMIT=NONE] -->
- <string name="recents_incompatible_app_message">App doesn\'t support split screen</string>
<!-- Recents: Hint text that shows on the drop targets to start multiwindow. [CHAR LIMIT=NONE] -->
<string name="recents_drag_hint_message">Drag here to use split screen</string>
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index 6cda076..87f8ddb 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -172,7 +172,8 @@
mInputConsumerController);
mTouchHandler = new PipTouchHandler(context, mActivityManager, mMenuController,
mInputConsumerController);
- mNotificationController = new PipNotificationController(context, mActivityManager);
+ mNotificationController = new PipNotificationController(context, mActivityManager,
+ mTouchHandler.getMotionHelper());
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipNotificationController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipNotificationController.java
index 9bf6d6e..db83b8b 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipNotificationController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipNotificationController.java
@@ -16,11 +16,15 @@
package com.android.systemui.pip.phone;
+import static android.app.AppOpsManager.MODE_ALLOWED;
+import static android.app.AppOpsManager.OP_PICTURE_IN_PICTURE;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.provider.Settings.ACTION_PICTURE_IN_PICTURE_SETTINGS;
+import android.app.AppOpsManager;
+import android.app.AppOpsManager.OnOpChangedListener;
import android.app.IActivityManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -51,12 +55,36 @@
private Context mContext;
private IActivityManager mActivityManager;
+ private AppOpsManager mAppOpsManager;
private NotificationManager mNotificationManager;
- public PipNotificationController(Context context, IActivityManager activityManager) {
+ private PipMotionHelper mMotionHelper;
+
+ private AppOpsManager.OnOpChangedListener mAppOpsChangedListener = new OnOpChangedListener() {
+ @Override
+ public void onOpChanged(String op, String packageName) {
+ try {
+ // Dismiss the PiP once the user disables the app ops setting for that package
+ final ApplicationInfo appInfo = mContext.getPackageManager().getApplicationInfo(
+ packageName, 0);
+ if (mAppOpsManager.checkOpNoThrow(OP_PICTURE_IN_PICTURE, appInfo.uid, packageName)
+ != MODE_ALLOWED) {
+ mMotionHelper.dismissPip();
+ }
+ } catch (NameNotFoundException e) {
+ // Unregister the listener if the package can't be found
+ unregisterAppOpsListener();
+ }
+ }
+ };
+
+ public PipNotificationController(Context context, IActivityManager activityManager,
+ PipMotionHelper motionHelper) {
mContext = context;
mActivityManager = activityManager;
+ mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mNotificationManager = NotificationManager.from(context);
+ mMotionHelper = motionHelper;
}
public void onActivityPinned(String packageName) {
@@ -77,9 +105,15 @@
// Show the new notification
mNotificationManager.notify(NOTIFICATION_TAG, NOTIFICATION_ID, builder.build());
}
+
+ // Register for changes to the app ops setting for this package while it is in PiP
+ registerAppOpsListener(packageName);
}
public void onActivityUnpinned() {
+ // Unregister for changes to the previously PiP'ed package
+ unregisterAppOpsListener();
+
ComponentName topPipActivity = PipUtils.getTopPinnedActivity(mContext, mActivityManager);
if (topPipActivity != null) {
onActivityPinned(topPipActivity.getPackageName());
@@ -123,4 +157,13 @@
}
return false;
}
+
+ private void registerAppOpsListener(String packageName) {
+ mAppOpsManager.startWatchingMode(OP_PICTURE_IN_PICTURE, packageName,
+ mAppOpsChangedListener);
+ }
+
+ private void unregisterAppOpsListener() {
+ mAppOpsManager.stopWatchingMode(mAppOpsChangedListener);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
index d8e5542..596d3bc 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
@@ -209,7 +209,7 @@
for (String tile : defTiles.split(",")) {
tiles.add(tile);
}
- mTileAdapter.setTileSpecs(tiles);
+ mTileAdapter.resetTileSpecs(mHost, tiles);
}
private void setTileSpecs() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
index c33d7da..0a0d2ce 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
@@ -114,6 +114,12 @@
mCurrentSpecs = newSpecs;
}
+ public void resetTileSpecs(QSTileHost host, List<String> specs) {
+ // Notify the host so the tiles get removed callbacks.
+ host.changeTiles(mCurrentSpecs, specs);
+ setTileSpecs(specs);
+ }
+
public void setTileSpecs(List<String> currentSpecs) {
if (currentSpecs.equals(mCurrentSpecs)) {
return;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 6da8272..d3bd89f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -474,7 +474,7 @@
return true;
} else {
EventBus.getDefault().send(new ShowUserToastEvent(
- R.string.recents_incompatible_app_message, Toast.LENGTH_SHORT));
+ R.string.dock_non_resizeble_failed_to_dock_text, Toast.LENGTH_SHORT));
return false;
}
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index a5f7832..b8be580 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -610,8 +610,8 @@
if (mIncompatibleAppToastView == null) {
mIncompatibleAppToastView = Utilities.findViewStubById(this,
R.id.incompatible_app_toast_stub).inflate();
- TextView msg = (TextView) findViewById(com.android.internal.R.id.message);
- msg.setText(R.string.recents_incompatible_app_message);
+ TextView msg = findViewById(com.android.internal.R.id.message);
+ msg.setText(R.string.dock_non_resizeble_failed_to_dock_text);
}
mIncompatibleAppToastView.setVisibility(View.VISIBLE);
} else if (mIncompatibleAppToastView != null) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java
new file mode 100644
index 0000000..6e7d99e
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.systemui.qs.customize;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+import android.testing.TestableLooper.RunWithLooper;
+
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.qs.QSTileHost;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Collections;
+
+@RunWith(AndroidTestingRunner.class)
+@RunWithLooper
+public class TileAdapterTest extends SysuiTestCase {
+
+ private TileAdapter mTileAdapter;
+
+ @Before
+ public void setup() throws Exception {
+ TestableLooper.get(this).runWithLooper(() -> mTileAdapter = new TileAdapter(mContext));
+ }
+
+ @Test
+ public void testResetNotifiesHost() {
+ QSTileHost host = mock(QSTileHost.class);
+ mTileAdapter.resetTileSpecs(host, Collections.emptyList());
+ verify(host).changeTiles(any(), any());
+ }
+}
diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
index db133f8..5bdef9e 100644
--- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
+++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
@@ -102,7 +102,8 @@
if (oi == null) {
// This overlay does not exist in our settings.
- if (mDefaultOverlays.contains(overlayPackage.packageName)) {
+ if (overlayPackage.isStaticOverlay ||
+ mDefaultOverlays.contains(overlayPackage.packageName)) {
// Enable this overlay by default.
mSettings.setEnabled(overlayPackage.packageName, newUserId, true);
}
diff --git a/wifi/java/android/net/wifi/aware/DiscoverySessionCallback.java b/wifi/java/android/net/wifi/aware/DiscoverySessionCallback.java
index 9645b1d..334205b 100644
--- a/wifi/java/android/net/wifi/aware/DiscoverySessionCallback.java
+++ b/wifi/java/android/net/wifi/aware/DiscoverySessionCallback.java
@@ -85,7 +85,7 @@
/**
* Called when a discovery session (publish or subscribe) terminates. Termination may be due
* to user-request (either directly through {@link DiscoverySession#destroy()} or
- * application-specified expiration, e.g. {@link PublishConfig.Builder#setPublishCount(int)}
+ * application-specified expiration, e.g. {@link PublishConfig.Builder#setTtlSec(int)}
* or {@link SubscribeConfig.Builder#setTtlSec(int)}).
*/
public void onSessionTerminated() {
diff --git a/wifi/java/android/net/wifi/aware/PublishConfig.java b/wifi/java/android/net/wifi/aware/PublishConfig.java
index a996844..1ce12f3 100644
--- a/wifi/java/android/net/wifi/aware/PublishConfig.java
+++ b/wifi/java/android/net/wifi/aware/PublishConfig.java
@@ -75,9 +75,6 @@
public final int mPublishType;
/** @hide */
- public final int mPublishCount;
-
- /** @hide */
public final int mTtlSec;
/** @hide */
@@ -85,12 +82,11 @@
/** @hide */
public PublishConfig(byte[] serviceName, byte[] serviceSpecificInfo, byte[] matchFilter,
- int publishType, int publichCount, int ttlSec, boolean enableTerminateNotification) {
+ int publishType, int ttlSec, boolean enableTerminateNotification) {
mServiceName = serviceName;
mServiceSpecificInfo = serviceSpecificInfo;
mMatchFilter = matchFilter;
mPublishType = publishType;
- mPublishCount = publichCount;
mTtlSec = ttlSec;
mEnableTerminateNotification = enableTerminateNotification;
}
@@ -100,8 +96,8 @@
return "PublishConfig [mServiceName='" + mServiceName + ", mServiceSpecificInfo='" + (
(mServiceSpecificInfo == null) ? "null" : HexEncoding.encode(mServiceSpecificInfo))
+ ", mMatchFilter=" + (new TlvBufferUtils.TlvIterable(0, 1,
- mMatchFilter)).toString() + ", mPublishType=" + mPublishType + ", mPublishCount="
- + mPublishCount + ", mTtlSec=" + mTtlSec + ", mEnableTerminateNotification="
+ mMatchFilter)).toString() + ", mPublishType=" + mPublishType
+ + ", mTtlSec=" + mTtlSec + ", mEnableTerminateNotification="
+ mEnableTerminateNotification + "]";
}
@@ -116,7 +112,6 @@
dest.writeByteArray(mServiceSpecificInfo);
dest.writeByteArray(mMatchFilter);
dest.writeInt(mPublishType);
- dest.writeInt(mPublishCount);
dest.writeInt(mTtlSec);
dest.writeInt(mEnableTerminateNotification ? 1 : 0);
}
@@ -133,11 +128,10 @@
byte[] ssi = in.createByteArray();
byte[] matchFilter = in.createByteArray();
int publishType = in.readInt();
- int publishCount = in.readInt();
int ttlSec = in.readInt();
boolean enableTerminateNotification = in.readInt() != 0;
- return new PublishConfig(serviceName, ssi, matchFilter, publishType, publishCount,
+ return new PublishConfig(serviceName, ssi, matchFilter, publishType,
ttlSec, enableTerminateNotification);
}
};
@@ -156,7 +150,7 @@
return Arrays.equals(mServiceName, lhs.mServiceName) && Arrays.equals(mServiceSpecificInfo,
lhs.mServiceSpecificInfo) && Arrays.equals(mMatchFilter, lhs.mMatchFilter)
- && mPublishType == lhs.mPublishType && mPublishCount == lhs.mPublishCount
+ && mPublishType == lhs.mPublishType
&& mTtlSec == lhs.mTtlSec
&& mEnableTerminateNotification == lhs.mEnableTerminateNotification;
}
@@ -169,7 +163,6 @@
result = 31 * result + Arrays.hashCode(mServiceSpecificInfo);
result = 31 * result + Arrays.hashCode(mMatchFilter);
result = 31 * result + mPublishType;
- result = 31 * result + mPublishCount;
result = 31 * result + mTtlSec;
result = 31 * result + (mEnableTerminateNotification ? 1 : 0);
@@ -193,9 +186,6 @@
if (mPublishType < PUBLISH_TYPE_UNSOLICITED || mPublishType > PUBLISH_TYPE_SOLICITED) {
throw new IllegalArgumentException("Invalid publishType - " + mPublishType);
}
- if (mPublishCount < 0) {
- throw new IllegalArgumentException("Invalid publishCount - must be non-negative");
- }
if (mTtlSec < 0) {
throw new IllegalArgumentException("Invalid ttlSec - must be non-negative");
}
@@ -229,7 +219,6 @@
private byte[] mServiceSpecificInfo;
private byte[] mMatchFilter;
private int mPublishType = PUBLISH_TYPE_UNSOLICITED;
- private int mPublishCount = 0;
private int mTtlSec = 0;
private boolean mEnableTerminateNotification = true;
@@ -317,30 +306,6 @@
}
/**
- * Sets the number of times an unsolicited (configured using
- * {@link PublishConfig.Builder#setPublishType(int)}) publish session
- * will be broadcast. When the count is reached an event will be
- * generated for {@link DiscoverySessionCallback#onSessionTerminated()}
- * [unless {@link #setTerminateNotificationEnabled(boolean)} disables the callback].
- * <p>
- * Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link DiscoverySession#destroy()} is
- * called.
- *
- * @param publishCount Number of publish packets to broadcast.
- *
- * @return The builder to facilitate chaining
- * {@code builder.setXXX(..).setXXX(..)}.
- */
- public Builder setPublishCount(int publishCount) {
- if (publishCount < 0) {
- throw new IllegalArgumentException("Invalid publishCount - must be non-negative");
- }
- mPublishCount = publishCount;
- return this;
- }
-
- /**
* Sets the time interval (in seconds) an unsolicited (
* {@link PublishConfig.Builder#setPublishType(int)}) publish session
* will be alive - broadcasting a packet. When the TTL is reached
@@ -387,7 +352,7 @@
*/
public PublishConfig build() {
return new PublishConfig(mServiceName, mServiceSpecificInfo, mMatchFilter, mPublishType,
- mPublishCount, mTtlSec, mEnableTerminateNotification);
+ mTtlSec, mEnableTerminateNotification);
}
}
}
diff --git a/wifi/java/android/net/wifi/aware/SubscribeConfig.java b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
index 3397c4b..97a6a3f 100644
--- a/wifi/java/android/net/wifi/aware/SubscribeConfig.java
+++ b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
@@ -94,9 +94,6 @@
public final int mSubscribeType;
/** @hide */
- public final int mSubscribeCount;
-
- /** @hide */
public final int mTtlSec;
/** @hide */
@@ -107,13 +104,12 @@
/** @hide */
public SubscribeConfig(byte[] serviceName, byte[] serviceSpecificInfo, byte[] matchFilter,
- int subscribeType, int publichCount, int ttlSec, int matchStyle,
+ int subscribeType, int ttlSec, int matchStyle,
boolean enableTerminateNotification) {
mServiceName = serviceName;
mServiceSpecificInfo = serviceSpecificInfo;
mMatchFilter = matchFilter;
mSubscribeType = subscribeType;
- mSubscribeCount = publichCount;
mTtlSec = ttlSec;
mMatchStyle = matchStyle;
mEnableTerminateNotification = enableTerminateNotification;
@@ -125,7 +121,7 @@
(mServiceSpecificInfo == null) ? "null" : HexEncoding.encode(mServiceSpecificInfo))
+ ", mMatchFilter=" + (new TlvBufferUtils.TlvIterable(0, 1,
mMatchFilter)).toString() + ", mSubscribeType=" + mSubscribeType
- + ", mSubscribeCount=" + mSubscribeCount + ", mTtlSec=" + mTtlSec + ", mMatchType="
+ + ", mTtlSec=" + mTtlSec + ", mMatchType="
+ mMatchStyle + ", mEnableTerminateNotification=" + mEnableTerminateNotification
+ "]";
}
@@ -141,7 +137,6 @@
dest.writeByteArray(mServiceSpecificInfo);
dest.writeByteArray(mMatchFilter);
dest.writeInt(mSubscribeType);
- dest.writeInt(mSubscribeCount);
dest.writeInt(mTtlSec);
dest.writeInt(mMatchStyle);
dest.writeInt(mEnableTerminateNotification ? 1 : 0);
@@ -159,12 +154,11 @@
byte[] ssi = in.createByteArray();
byte[] matchFilter = in.createByteArray();
int subscribeType = in.readInt();
- int subscribeCount = in.readInt();
int ttlSec = in.readInt();
int matchStyle = in.readInt();
boolean enableTerminateNotification = in.readInt() != 0;
- return new SubscribeConfig(serviceName, ssi, matchFilter, subscribeType, subscribeCount,
+ return new SubscribeConfig(serviceName, ssi, matchFilter, subscribeType,
ttlSec, matchStyle, enableTerminateNotification);
}
};
@@ -183,7 +177,7 @@
return Arrays.equals(mServiceName, lhs.mServiceName) && Arrays.equals(mServiceSpecificInfo,
lhs.mServiceSpecificInfo) && Arrays.equals(mMatchFilter, lhs.mMatchFilter)
- && mSubscribeType == lhs.mSubscribeType && mSubscribeCount == lhs.mSubscribeCount
+ && mSubscribeType == lhs.mSubscribeType
&& mTtlSec == lhs.mTtlSec && mMatchStyle == lhs.mMatchStyle
&& mEnableTerminateNotification == lhs.mEnableTerminateNotification;
}
@@ -196,7 +190,6 @@
result = 31 * result + Arrays.hashCode(mServiceSpecificInfo);
result = 31 * result + Arrays.hashCode(mMatchFilter);
result = 31 * result + mSubscribeType;
- result = 31 * result + mSubscribeCount;
result = 31 * result + mTtlSec;
result = 31 * result + mMatchStyle;
result = 31 * result + (mEnableTerminateNotification ? 1 : 0);
@@ -221,9 +214,6 @@
if (mSubscribeType < SUBSCRIBE_TYPE_PASSIVE || mSubscribeType > SUBSCRIBE_TYPE_ACTIVE) {
throw new IllegalArgumentException("Invalid subscribeType - " + mSubscribeType);
}
- if (mSubscribeCount < 0) {
- throw new IllegalArgumentException("Invalid subscribeCount - must be non-negative");
- }
if (mTtlSec < 0) {
throw new IllegalArgumentException("Invalid ttlSec - must be non-negative");
}
@@ -261,7 +251,6 @@
private byte[] mServiceSpecificInfo;
private byte[] mMatchFilter;
private int mSubscribeType = SUBSCRIBE_TYPE_PASSIVE;
- private int mSubscribeCount = 0;
private int mTtlSec = 0;
private int mMatchStyle = MATCH_STYLE_ALL;
private boolean mEnableTerminateNotification = true;
@@ -350,29 +339,6 @@
}
/**
- * Sets the number of times an active (
- * {@link SubscribeConfig.Builder#setSubscribeType(int)}) subscribe session
- * will broadcast. When the count is reached an event will be
- * generated for {@link DiscoverySessionCallback#onSessionTerminated()}.
- * <p>
- * Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link DiscoverySession#destroy()} is
- * called.
- *
- * @param subscribeCount Number of subscribe packets to broadcast.
- *
- * @return The builder to facilitate chaining
- * {@code builder.setXXX(..).setXXX(..)}.
- */
- public Builder setSubscribeCount(int subscribeCount) {
- if (subscribeCount < 0) {
- throw new IllegalArgumentException("Invalid subscribeCount - must be non-negative");
- }
- mSubscribeCount = subscribeCount;
- return this;
- }
-
- /**
* Sets the time interval (in seconds) an active (
* {@link SubscribeConfig.Builder#setSubscribeType(int)}) subscribe session
* will be alive - i.e. broadcasting a packet. When the TTL is reached
@@ -440,7 +406,7 @@
*/
public SubscribeConfig build() {
return new SubscribeConfig(mServiceName, mServiceSpecificInfo, mMatchFilter,
- mSubscribeType, mSubscribeCount, mTtlSec, mMatchStyle,
+ mSubscribeType, mTtlSec, mMatchStyle,
mEnableTerminateNotification);
}
}
diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
index 4387b0c..830db22 100644
--- a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
@@ -688,7 +688,6 @@
collector.checkThat("mServiceName", subscribeConfig.mServiceName, equalTo(null));
collector.checkThat("mSubscribeType", subscribeConfig.mSubscribeType,
equalTo(SubscribeConfig.SUBSCRIBE_TYPE_PASSIVE));
- collector.checkThat("mSubscribeCount", subscribeConfig.mSubscribeCount, equalTo(0));
collector.checkThat("mTtlSec", subscribeConfig.mTtlSec, equalTo(0));
collector.checkThat("mMatchStyle", subscribeConfig.mMatchStyle,
equalTo(SubscribeConfig.MATCH_STYLE_ALL));
@@ -711,7 +710,7 @@
.setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter(
new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList())
.setSubscribeType(subscribeType)
- .setSubscribeCount(subscribeCount).setTtlSec(subscribeTtl).setMatchStyle(matchStyle)
+ .setTtlSec(subscribeTtl).setMatchStyle(matchStyle)
.setTerminateNotificationEnabled(enableTerminateNotification).build();
collector.checkThat("mServiceName", serviceName.getBytes(),
@@ -721,8 +720,6 @@
collector.checkThat("mMatchFilter", matchFilter, equalTo(subscribeConfig.mMatchFilter));
collector.checkThat("mSubscribeType", subscribeType,
equalTo(subscribeConfig.mSubscribeType));
- collector.checkThat("mSubscribeCount", subscribeCount,
- equalTo(subscribeConfig.mSubscribeCount));
collector.checkThat("mTtlSec", subscribeTtl, equalTo(subscribeConfig.mTtlSec));
collector.checkThat("mMatchStyle", matchStyle, equalTo(subscribeConfig.mMatchStyle));
collector.checkThat("mEnableTerminateNotification", enableTerminateNotification,
@@ -744,7 +741,7 @@
.setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter(
new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList())
.setSubscribeType(subscribeType)
- .setSubscribeCount(subscribeCount).setTtlSec(subscribeTtl).setMatchStyle(matchStyle)
+ .setTtlSec(subscribeTtl).setMatchStyle(matchStyle)
.setTerminateNotificationEnabled(enableTerminateNotification).build();
Parcel parcelW = Parcel.obtain();
@@ -766,11 +763,6 @@
}
@Test(expected = IllegalArgumentException.class)
- public void testSubscribeConfigBuilderNegativeCount() {
- new SubscribeConfig.Builder().setSubscribeCount(-1);
- }
-
- @Test(expected = IllegalArgumentException.class)
public void testSubscribeConfigBuilderNegativeTtl() {
new SubscribeConfig.Builder().setTtlSec(-100);
}
@@ -794,7 +786,6 @@
collector.checkThat("mServiceName", publishConfig.mServiceName, equalTo(null));
collector.checkThat("mPublishType", publishConfig.mPublishType,
equalTo(PublishConfig.PUBLISH_TYPE_UNSOLICITED));
- collector.checkThat("mPublishCount", publishConfig.mPublishCount, equalTo(0));
collector.checkThat("mTtlSec", publishConfig.mTtlSec, equalTo(0));
collector.checkThat("mEnableTerminateNotification",
publishConfig.mEnableTerminateNotification, equalTo(true));
@@ -814,7 +805,7 @@
.setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter(
new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList())
.setPublishType(publishType)
- .setPublishCount(publishCount).setTtlSec(publishTtl)
+ .setTtlSec(publishTtl)
.setTerminateNotificationEnabled(enableTerminateNotification).build();
collector.checkThat("mServiceName", serviceName.getBytes(),
@@ -823,7 +814,6 @@
serviceSpecificInfo.getBytes(), equalTo(publishConfig.mServiceSpecificInfo));
collector.checkThat("mMatchFilter", matchFilter, equalTo(publishConfig.mMatchFilter));
collector.checkThat("mPublishType", publishType, equalTo(publishConfig.mPublishType));
- collector.checkThat("mPublishCount", publishCount, equalTo(publishConfig.mPublishCount));
collector.checkThat("mTtlSec", publishTtl, equalTo(publishConfig.mTtlSec));
collector.checkThat("mEnableTerminateNotification", enableTerminateNotification,
equalTo(publishConfig.mEnableTerminateNotification));
@@ -843,7 +833,7 @@
.setServiceSpecificInfo(serviceSpecificInfo.getBytes()).setMatchFilter(
new TlvBufferUtils.TlvIterable(0, 1, matchFilter).toList())
.setPublishType(publishType)
- .setPublishCount(publishCount).setTtlSec(publishTtl)
+ .setTtlSec(publishTtl)
.setTerminateNotificationEnabled(enableTerminateNotification).build();
Parcel parcelW = Parcel.obtain();
@@ -865,11 +855,6 @@
}
@Test(expected = IllegalArgumentException.class)
- public void testPublishConfigBuilderNegativeCount() {
- new PublishConfig.Builder().setPublishCount(-4);
- }
-
- @Test(expected = IllegalArgumentException.class)
public void testPublishConfigBuilderNegativeTtl() {
new PublishConfig.Builder().setTtlSec(-10);
}