Opp: Remove unused Constants.EXTRA_SHOW_ALL_FILES
There is no place that uses EXTRA_SHOW_ALL_FILES.
This CL removes it and all the related code.
Bug: 318610752
Test: atest BluetoothOppTransferHistoryTest
Test: m -j;
Flag: EXEMPT, dead code removal
Change-Id: I7cc45bce7bb2c0e2bcbc5ea950fdff8e546e45d9
diff --git a/android/app/res/menu/receivedfilescontextfinished.xml b/android/app/res/menu/receivedfilescontextfinished.xml
deleted file mode 100644
index 79bfa3f..0000000
--- a/android/app/res/menu/receivedfilescontextfinished.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:id="@+id/transfer_menu_open"
- android:title="@string/transfer_menu_open" />
-
-</menu>
diff --git a/android/app/res/values/strings.xml b/android/app/res/values/strings.xml
index 4018d3c..78a3dd6 100644
--- a/android/app/res/values/strings.xml
+++ b/android/app/res/values/strings.xml
@@ -203,9 +203,6 @@
<string name="status_protocol_error">Request can\'t be handled correctly.</string>
<string name="status_unknown_error">Unknown error.</string>
- <!-- Bluetooth OPP Live Folder -->
- <string name="btopp_live_folder">Bluetooth received</string>
-
<!-- Bluetooth OPP Transfer History -->
<string name="opp_notification_group">Bluetooth Share</string>
<string name="download_success"> <xliff:g id="file_size">%1$s</xliff:g> Received complete.</string>
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransferHistory.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransferHistory.java
index b36c1f4..fbc8d5c 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransferHistory.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransferHistory.java
@@ -74,8 +74,6 @@
mListView = (ListView) findViewById(R.id.list);
mListView.setEmptyView(findViewById(R.id.empty));
- mShowAllIncoming = getIntent().getBooleanExtra(Constants.EXTRA_SHOW_ALL_FILES, false);
-
String direction;
int dir = getIntent().getIntExtra(Constants.EXTRA_DIRECTION, 0);
if (dir == BluetoothShare.DIRECTION_OUTBOUND) {
@@ -83,22 +81,15 @@
direction = "(" + BluetoothShare.DIRECTION + " == " + BluetoothShare.DIRECTION_OUTBOUND
+ ")";
} else {
- if (mShowAllIncoming) {
- setTitle(getText(R.string.btopp_live_folder));
- } else {
- setTitle(getText(R.string.inbound_history_title));
- }
+ setTitle(getText(R.string.inbound_history_title));
direction = "(" + BluetoothShare.DIRECTION + " == " + BluetoothShare.DIRECTION_INBOUND
+ ")";
}
- String selection = BluetoothShare.STATUS + " >= '200' AND " + direction;
-
- if (!mShowAllIncoming) {
- selection = selection + " AND (" + BluetoothShare.VISIBILITY + " IS NULL OR "
+ String selection = BluetoothShare.STATUS + " >= '200' AND " + direction + " AND ("
+ + BluetoothShare.VISIBILITY + " IS NULL OR "
+ BluetoothShare.VISIBILITY + " == '" + BluetoothShare.VISIBILITY_VISIBLE
+ "')";
- }
final String sortOrder = BluetoothShare.TIMESTAMP + " DESC";
mTransferCursor = BluetoothMethodProxy.getInstance().contentResolverQuery(
@@ -134,7 +125,7 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- if (mTransferCursor != null && !mShowAllIncoming) {
+ if (mTransferCursor != null) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.transferhistory, menu);
}
@@ -143,9 +134,7 @@
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- if (!mShowAllIncoming) {
- menu.findItem(R.id.transfer_menu_clear_all).setEnabled(isTransferComplete());
- }
+ menu.findItem(R.id.transfer_menu_clear_all).setEnabled(isTransferComplete());
return super.onPrepareOptionsMenu(menu);
}
@@ -204,13 +193,7 @@
fileName = this.getString(R.string.unknown_file);
}
menu.setHeaderTitle(fileName);
-
- MenuInflater inflater = getMenuInflater();
- if (mShowAllIncoming) {
- inflater.inflate(R.menu.receivedfilescontextfinished, menu);
- } else {
- inflater.inflate(R.menu.transferhistorycontextfinished, menu);
- }
+ getMenuInflater().inflate(R.menu.transferhistorycontextfinished, menu);
}
}
diff --git a/android/app/src/com/android/bluetooth/opp/Constants.java b/android/app/src/com/android/bluetooth/opp/Constants.java
index 9eb1a6e..c6aa01c 100644
--- a/android/app/src/com/android/bluetooth/opp/Constants.java
+++ b/android/app/src/com/android/bluetooth/opp/Constants.java
@@ -66,9 +66,6 @@
*/
static final String EXTRA_DIRECTION = "android.btopp.intent.extra.DIRECTION";
- /** the intent extra to show all received files in the transfer history */
- static final String EXTRA_SHOW_ALL_FILES = "android.btopp.intent.extra.SHOW_ALL";
-
/** the intent that gets sent when clicking an incomplete/failed transfer */
static final String ACTION_LIST = "android.btopp.intent.action.LIST";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
index 67430f0..45fdc91 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
@@ -137,28 +137,11 @@
}
@Test
- public void onCreate_withDirectionInbound_withExtraShowAllFileIsTrue_displayLiveFolder()
- throws Exception {
+ public void onCreate_withDirectionInbound_displayInboundHistory() {
Assume.assumeFalse(
mTargetContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH));
BluetoothOppTestUtils.setUpMockCursor(mCursor, mCursorMockDataList);
- mIntent.putExtra(Constants.EXTRA_SHOW_ALL_FILES, true);
- mIntent.putExtra(Constants.EXTRA_DIRECTION, BluetoothShare.DIRECTION_INBOUND);
- ActivityScenario<BluetoothOppTransferHistory> scenario = ActivityScenario.launch(mIntent);
- InstrumentationRegistry.getInstrumentation().waitForIdleSync();
-
- onView(withText(mTargetContext.getText(R.string.btopp_live_folder).toString())).check(
- matches(isDisplayed()));
- }
-
- @Test
- public void onCreate_withDirectionInbound_withExtraShowAllFileIsFalse_displayInboundHistory() {
- Assume.assumeFalse(
- mTargetContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH));
-
- BluetoothOppTestUtils.setUpMockCursor(mCursor, mCursorMockDataList);
- mIntent.putExtra(Constants.EXTRA_SHOW_ALL_FILES, false);
mIntent.putExtra(Constants.EXTRA_DIRECTION, BluetoothShare.DIRECTION_INBOUND);
ActivityScenario<BluetoothOppTransferHistory> scenario = ActivityScenario.launch(mIntent);
@@ -177,7 +160,6 @@
mCursorMockDataList.set(1,
new BluetoothOppTestUtils.CursorMockData(BluetoothShare.DIRECTION, 2,
BluetoothShare.DIRECTION_OUTBOUND));
- mIntent.putExtra(Constants.EXTRA_SHOW_ALL_FILES, true);
mIntent.putExtra(Constants.EXTRA_DIRECTION, BluetoothShare.DIRECTION_OUTBOUND);
ActivityScenario<BluetoothOppTransferHistory> scenario = ActivityScenario.launch(mIntent);
@@ -192,7 +174,6 @@
@Test
public void onOptionsItemSelected_clearAllSelected_promptWarning() {
BluetoothOppTestUtils.setUpMockCursor(mCursor, mCursorMockDataList);
- mIntent.putExtra(Constants.EXTRA_SHOW_ALL_FILES, false);
mIntent.putExtra(Constants.EXTRA_DIRECTION, BluetoothShare.DIRECTION_INBOUND);
ActivityScenario<BluetoothOppTransferHistory> scenario = ActivityScenario.launch(mIntent);