[automerger skipped] Merge "Import translations. DO NOT MERGE ANYWHERE" into tm-mainline-prod am: d46277f6e7 -s ours
am skip reason: subject contains skip directive
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Contacts/+/19551814
Change-Id: Ic8479b7e7ad2dc01848ae4f7ee971fd0682d8449
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e974863..0e59458 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -45,7 +45,6 @@
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SET_DEFAULT_ACCOUNT_FOR_CONTACTS"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<!-- Following used for Contact metadata syncing -->
@@ -55,7 +54,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<!-- Required in P to run Service.startForeground() -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
- <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
+ <uses-permission android:name="android.permission.HIDE_OVERLAY_WINDOWS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-feature
diff --git a/src/com/android/contacts/NfcHandler.java b/src/com/android/contacts/NfcHandler.java
deleted file mode 100644
index 07b3f06..0000000
--- a/src/com/android/contacts/NfcHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.app.Activity;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.net.Uri;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcEvent;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Profile;
-import android.util.Log;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * This class implements sharing the currently displayed
- * contact to another device using NFC. NFC sharing is only
- * enabled when the activity is in the foreground and resumed.
- * When an NFC link is established, {@link #createMessage}
- * will be called to create the data to be sent over the link,
- * which is a vCard in this case.
- */
-public class NfcHandler implements NfcAdapter.CreateNdefMessageCallback {
-
- private static final String TAG = "ContactNfcHandler";
- private static final String PROFILE_LOOKUP_KEY = "profile";
- private final Context mContext;
- private final Uri mContactUri;
-
- /* Register NFC handler. This should be called in activities' onCreate(), or similar methods */
- public static void register(Activity activity, Uri contactUri) {
- NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity.getApplicationContext());
- if (adapter == null) {
- return; // NFC not available on this device
- }
- adapter.setNdefPushMessageCallback(new NfcHandler(activity, contactUri), activity);
- }
-
- public NfcHandler(Context context, Uri contactUri) {
- mContext = context;
- mContactUri = contactUri;
- }
-
- @Override
- public NdefMessage createNdefMessage(NfcEvent event) {
- ContentResolver resolver = mContext.getContentResolver();
- if (mContactUri != null) {
- final String lookupKey = Uri.encode(mContactUri.getPathSegments().get(2));
- final Uri shareUri;
- // TODO find out where to get this constant from, or find another way
- // of determining this.
- if (lookupKey.equals(PROFILE_LOOKUP_KEY)) {
- shareUri = Profile.CONTENT_VCARD_URI.buildUpon().
- appendQueryParameter(Contacts.QUERY_PARAMETER_VCARD_NO_PHOTO, "true").
- build();
- } else {
- shareUri = Contacts.CONTENT_VCARD_URI.buildUpon().
- appendPath(lookupKey).
- appendQueryParameter(Contacts.QUERY_PARAMETER_VCARD_NO_PHOTO, "true").
- build();
- }
- ByteArrayOutputStream ndefBytes = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int r;
- try {
- InputStream vcardInputStream = resolver.openInputStream(shareUri);
- while ((r = vcardInputStream.read(buffer)) > 0) {
- ndefBytes.write(buffer, 0, r);
- }
-
- NdefRecord record = NdefRecord.createMime("text/x-vcard", ndefBytes.toByteArray());
- return new NdefMessage(record);
- } catch (IOException e) {
- Log.e(TAG, "IOException creating vcard.");
- return null;
- }
- } else {
- Log.w(TAG, "No contact URI to share.");
- return null;
- }
- }
-}
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 74a0df6..2af25f8 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -314,6 +314,8 @@
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
+ getWindow().setHideOverlayWindows(true);
+
RequestPermissionsActivity.startPermissionActivityIfNeeded(this);
final Intent intent = getIntent();
diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java
index 2057c9d..9273c61 100644
--- a/src/com/android/contacts/activities/ContactSelectionActivity.java
+++ b/src/com/android/contacts/activities/ContactSelectionActivity.java
@@ -107,8 +107,7 @@
protected void onCreate(Bundle savedState) {
super.onCreate(savedState);
- getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
- .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ getWindow().setHideOverlayWindows(true);
RequestPermissionsActivity.startPermissionActivityIfNeeded(this);
diff --git a/src/com/android/contacts/activities/RequestImportVCardPermissionsActivity.java b/src/com/android/contacts/activities/RequestImportVCardPermissionsActivity.java
index 224339a..2f17fe7 100644
--- a/src/com/android/contacts/activities/RequestImportVCardPermissionsActivity.java
+++ b/src/com/android/contacts/activities/RequestImportVCardPermissionsActivity.java
@@ -28,9 +28,7 @@
// Contacts group
permission.GET_ACCOUNTS,
permission.READ_CONTACTS,
- permission.WRITE_CONTACTS,
- // Storage group
- permission.READ_EXTERNAL_STORAGE,
+ permission.WRITE_CONTACTS
};
@Override
diff --git a/src/com/android/contacts/dialog/CallSubjectDialog.java b/src/com/android/contacts/dialog/CallSubjectDialog.java
index 036a0f3..ffce0f5 100644
--- a/src/com/android/contacts/dialog/CallSubjectDialog.java
+++ b/src/com/android/contacts/dialog/CallSubjectDialog.java
@@ -274,6 +274,7 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getWindow().setHideOverlayWindows(true);
mAnimationDuration = getResources().getInteger(R.integer.call_subject_animation_duration);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mPhotoSize = getResources().getDimensionPixelSize(
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 5b144e1..2c0d114 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -104,7 +104,6 @@
import com.android.contacts.ContactsActivity;
import com.android.contacts.ContactsUtils;
import com.android.contacts.DynamicShortcuts;
-import com.android.contacts.NfcHandler;
import com.android.contacts.R;
import com.android.contacts.ShortcutIntentBuilder;
import com.android.contacts.ShortcutIntentBuilder.OnShortcutIntentCreatedListener;
@@ -990,7 +989,6 @@
}
};
mEntriesAndActionsTask.execute();
- NfcHandler.register(this, mContactData.getLookupUri());
}
private void bindDataToCards(Cp2DataCardModel cp2DataCardModel) {
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
index 38367c4..6ddb8fa 100644
--- a/src/com/android/contacts/vcard/ImportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -546,8 +546,7 @@
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
- getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
- .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ getWindow().setHideOverlayWindows(true);
Uri sourceUri = getIntent().getData();
diff --git a/src/com/android/contacts/vcard/SelectAccountActivity.java b/src/com/android/contacts/vcard/SelectAccountActivity.java
index eb13e50..8ead5fa 100644
--- a/src/com/android/contacts/vcard/SelectAccountActivity.java
+++ b/src/com/android/contacts/vcard/SelectAccountActivity.java
@@ -52,8 +52,7 @@
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
- getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
- .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ getWindow().setHideOverlayWindows(true);
// There's three possibilities:
// - more than one accounts -> ask the user