Merge pull request #40 from loki-project/disable-permissions

Disabled unused permissions
This commit is contained in:
gmbnt 2019-11-18 13:22:48 +11:00 committed by GitHub
commit 28c5d0d11c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 3 deletions

View File

@ -11,9 +11,11 @@
<uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false" /> <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<!-- Loki - Enable again once we have location sharing
<uses-feature android:name="android.hardware.location" android:required="false"/> <uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/> <uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/> <uses-feature android:name="android.hardware.location.gps" android:required="false"/>
-->
<uses-feature android:name="android.hardware.microphone" android:required="false"/> <uses-feature android:name="android.hardware.microphone" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="false"/> <uses-feature android:name="android.hardware.wifi" android:required="false"/>
<uses-feature android:name="android.hardware.portrait" android:required="false"/> <uses-feature android:name="android.hardware.portrait" android:required="false"/>
@ -26,10 +28,12 @@
<uses-permission android:name="android.permission.WRITE_PROFILE"/> <uses-permission android:name="android.permission.WRITE_PROFILE"/>
<uses-permission android:name="android.permission.BROADCAST_WAP_PUSH" <uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"
tools:ignore="ProtectedPermissions"/> tools:ignore="ProtectedPermissions"/>
<!-- Loki - We don't need these at all
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<!-- <uses-permission android:name="android.permission.RECEIVE_SMS"/> <uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_MMS"/> <uses-permission android:name="android.permission.RECEIVE_MMS"/>
<uses-permission android:name="android.permission.READ_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.SEND_SMS"/>
@ -40,12 +44,14 @@
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<!-- Loki - Enable again once we have location sharing
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
-->
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CALL_STATE"/> <!-- <uses-permission android:name="android.permission.READ_CALL_STATE"/> -->
<!-- For sending/receiving events --> <!-- For sending/receiving events -->
<uses-permission android:name="android.permission.WRITE_CALENDAR"/> <uses-permission android:name="android.permission.WRITE_CALENDAR"/>

View File

@ -178,6 +178,7 @@ public class ContactSelectionListFragment extends Fragment
showContactsDescription.setText(R.string.contact_selection_list_fragment__signal_needs_access_to_your_contacts_in_order_to_display_them); showContactsDescription.setText(R.string.contact_selection_list_fragment__signal_needs_access_to_your_contacts_in_order_to_display_them);
showContactsButton.setVisibility(View.VISIBLE); showContactsButton.setVisibility(View.VISIBLE);
/*
showContactsButton.setOnClickListener(v -> { showContactsButton.setOnClickListener(v -> {
Permissions.with(this) Permissions.with(this)
.request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS) .request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS)
@ -190,6 +191,7 @@ public class ContactSelectionListFragment extends Fragment
}) })
.execute(); .execute();
}); });
*/
} }
public void setQueryFilter(String filter) { public void setQueryFilter(String filter) {

View File

@ -144,6 +144,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
private void initializeSearchListener() { private void initializeSearchListener() {
searchAction.setOnClickListener(v -> { searchAction.setOnClickListener(v -> {
/* Loki - We don't need contact permissions
Permissions.with(this) Permissions.with(this)
.request(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS) .request(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)
.ifNecessary() .ifNecessary()
@ -151,6 +152,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
searchAction.getY() + (searchAction.getHeight() / 2))) searchAction.getY() + (searchAction.getHeight() / 2)))
.withPermanentDenialDialog(getString(R.string.ConversationListActivity_signal_needs_contacts_permission_in_order_to_search_your_contacts_but_it_has_been_permanently_denied)) .withPermanentDenialDialog(getString(R.string.ConversationListActivity_signal_needs_contacts_permission_in_order_to_search_your_contacts_but_it_has_been_permanently_denied))
.execute(); .execute();
*/
}); });
searchToolbar.setListener(new SearchToolbar.SearchListener() { searchToolbar.setListener(new SearchToolbar.SearchListener() {

View File

@ -187,6 +187,8 @@ public class ContactsCursorLoader extends CursorLoader {
ContactsDatabase contactsDatabase = DatabaseFactory.getContactsDatabase(getContext()); ContactsDatabase contactsDatabase = DatabaseFactory.getContactsDatabase(getContext());
List<Cursor> cursorList = new ArrayList<>(2); List<Cursor> cursorList = new ArrayList<>(2);
return cursorList;
/*
if (!Permissions.hasAny(getContext(), Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) { if (!Permissions.hasAny(getContext(), Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) {
return cursorList; return cursorList;
} }
@ -201,6 +203,7 @@ public class ContactsCursorLoader extends CursorLoader {
cursorList.add(filterNonPushContacts(contactsDatabase.querySystemContacts(filter))); cursorList.add(filterNonPushContacts(contactsDatabase.querySystemContacts(filter)));
} }
return cursorList; return cursorList;
*/
} }
private Cursor getGroupsCursor() { private Cursor getGroupsCursor() {

View File

@ -1265,7 +1265,7 @@ public class ClassicOpenHelper extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_contact_photo TEXT DEFAULT NULL"); db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_contact_photo TEXT DEFAULT NULL");
db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_phone_label TEXT DEFAULT NULL"); db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_phone_label TEXT DEFAULT NULL");
db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_contact_uri TEXT DEFAULT NULL"); db.execSQL("ALTER TABLE recipient_preferences ADD COLUMN system_contact_uri TEXT DEFAULT NULL");
/*
if (Permissions.hasAny(context, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) { if (Permissions.hasAny(context, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) {
try (Cursor cursor = db.query("recipient_preferences", null, null, null, null, null, null)) { try (Cursor cursor = db.query("recipient_preferences", null, null, null, null, null, null)) {
while (cursor != null && cursor.moveToNext()) { while (cursor != null && cursor.moveToNext()) {
@ -1295,6 +1295,7 @@ public class ClassicOpenHelper extends SQLiteOpenHelper {
} }
} }
} }
*/
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();

View File

@ -410,6 +410,7 @@ public class AttachmentManager {
} }
public static void selectLocation(Activity activity, int requestCode) { public static void selectLocation(Activity activity, int requestCode) {
/* Loki - Enable again once we have location sharing
Permissions.with(activity) Permissions.with(activity)
.request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION) .request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)
.ifNecessary() .ifNecessary()
@ -422,6 +423,7 @@ public class AttachmentManager {
} }
}) })
.execute(); .execute();
*/
} }
public static void selectGif(Activity activity, int requestCode, boolean isForMms) { public static void selectGif(Activity activity, int requestCode, boolean isForMms) {

View File

@ -121,6 +121,8 @@ public class SearchRepository {
} }
private CursorList<Recipient> queryContacts(String query) { private CursorList<Recipient> queryContacts(String query) {
return CursorList.emptyList();
/* Loki - Don't need contact permissions
if (!Permissions.hasAny(context, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) { if (!Permissions.hasAny(context, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) {
return CursorList.emptyList(); return CursorList.emptyList();
} }
@ -130,6 +132,7 @@ public class SearchRepository {
MergeCursor contacts = new MergeCursor(new Cursor[]{ textSecureContacts, systemContacts }); MergeCursor contacts = new MergeCursor(new Cursor[]{ textSecureContacts, systemContacts });
return new CursorList<>(contacts, new RecipientModelBuilder(context)); return new CursorList<>(contacts, new RecipientModelBuilder(context));
*/
} }
private CursorList<ThreadRecord> queryConversations(@NonNull String query) { private CursorList<ThreadRecord> queryConversations(@NonNull String query) {

View File

@ -380,9 +380,11 @@ public class WebRtcCallService extends Service implements InjectableType,
try { try {
boolean isSystemContact = false; boolean isSystemContact = false;
/*
if (Permissions.hasAny(WebRtcCallService.this, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) { if (Permissions.hasAny(WebRtcCallService.this, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)) {
isSystemContact = ContactAccessor.getInstance().isSystemContact(WebRtcCallService.this, recipient.getAddress().serialize()); isSystemContact = ContactAccessor.getInstance().isSystemContact(WebRtcCallService.this, recipient.getAddress().serialize());
} }
*/
boolean isAlwaysTurn = TextSecurePreferences.isTurnOnly(WebRtcCallService.this); boolean isAlwaysTurn = TextSecurePreferences.isTurnOnly(WebRtcCallService.this);