Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit fb1caae9 authored by Henri Chataing's avatar Henri Chataing Committed by Michael Bestas
Browse files

Remove Nfc beam sharing capability

The Nfc Beam feature is now removed.

Test: m Gallery2
Bug: 236980291
Change-Id: I0de0904e74a73471a785b87cafebccbe25e7450f
(cherry picked from commit 617969afea0cca94aa2e76e23edc068453383389)
parent a15648fd
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Handler;
import android.view.ActionMode;
import android.view.ActionMode.Callback;
@@ -70,7 +69,6 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
    private final AbstractGalleryActivity mActivity;
    private final MenuExecutor mMenuExecutor;
    private final SelectionManager mSelectionManager;
    private final NfcAdapter mNfcAdapter;
    private Menu mMenu;
    private MenuItem mSharePanoramaMenuItem;
    private MenuItem mShareMenuItem;
@@ -133,7 +131,6 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
        mSelectionManager = Utils.checkNotNull(selectionManager);
        mMenuExecutor = new MenuExecutor(activity, selectionManager);
        mMainHandler = new Handler(activity.getMainLooper());
        mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity.getAndroidContext());
        mToolbar = mActivity.getToolbar();
    }

@@ -352,14 +349,6 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
        return size <= max;
    }

    @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
    private void setNfcBeamPushUris(Uri[] uris) {
        if (mNfcAdapter != null && ApiHelper.HAS_SET_BEAM_PUSH_URIS) {
            mNfcAdapter.setBeamPushUrisCallback(null, mActivity);
            mNfcAdapter.setBeamPushUris(uris, mActivity);
        }
    }

    // Share intent needs to expand the selection set so we can get URI of
    // each media item
    private Intent computePanoramaSharingIntent(JobContext jc, int maxItems) {
@@ -398,7 +387,6 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
    private Intent computeSharingIntent(JobContext jc, int maxItems) {
        ArrayList<Path> expandedPaths = mSelectionManager.getSelected(true, maxItems);
        if (expandedPaths == null || expandedPaths.size() == 0) {
            setNfcBeamPushUris(null);
            return new Intent();
        }
        final ArrayList<Uri> uris = new ArrayList<Uri>();
@@ -429,9 +417,6 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
                intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
            }
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
        } else {
            setNfcBeamPushUris(null);
        }

        return intent;