Messaging: Remove compatibility for old android versions
Change-Id: Id9065d60525a509271a0e64c0e349e857cb998e2
This commit is contained in:
@@ -123,11 +123,7 @@
|
||||
android:screenOrientation="user"
|
||||
android:label="@string/archived_activity_title"
|
||||
android:theme="@style/BugleTheme.ArchivedConversationListActivity"
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
|
||||
<!-- Displays the contents of a single conversation -->
|
||||
<activity
|
||||
@@ -136,11 +132,7 @@
|
||||
android:screenOrientation="user"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"
|
||||
android:theme="@style/BugleTheme.ConversationActivity"
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
|
||||
<!-- Blocked Participants -->
|
||||
<activity
|
||||
@@ -149,11 +141,7 @@
|
||||
android:screenOrientation="user"
|
||||
android:label="@string/blocked_contacts_title"
|
||||
android:theme="@style/BugleTheme"
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
|
||||
<!-- Full-screen photo viewer -->
|
||||
<activity
|
||||
@@ -171,11 +159,7 @@
|
||||
android:theme="@style/BugleTheme.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:screenOrientation="user"
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversationlist.ConversationListActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.appsettings.PerSubscriptionSettingsActivity"
|
||||
@@ -183,11 +167,7 @@
|
||||
android:theme="@style/BugleTheme.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:screenOrientation="user"
|
||||
android:parentActivityName="com.android.messaging.ui.appsettings.SettingsActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.appsettings.SettingsActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.appsettings.SettingsActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.appsettings.ApplicationSettingsActivity"
|
||||
@@ -197,10 +177,6 @@
|
||||
android:screenOrientation="user"
|
||||
android:parentActivityName="com.android.messaging.ui.appsettings.SettingsActivity"
|
||||
android:exported="true">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:exported="true"
|
||||
android:value="com.android.messaging.ui.appsettings.SettingsActivity" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@@ -239,11 +215,7 @@
|
||||
android:screenOrientation="user"
|
||||
android:label="@string/people_and_options_activity_title"
|
||||
android:theme="@style/BugleTheme"
|
||||
android:parentActivityName="com.android.messaging.ui.conversation.ConversationActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversation.ConversationActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversation.ConversationActivity" />
|
||||
|
||||
<!-- License -->
|
||||
<activity android:name=".ui.LicenseActivity"
|
||||
@@ -280,11 +252,8 @@
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:screenOrientation="user"
|
||||
android:label="@string/vcard_detail_activity_title"
|
||||
android:theme="@style/BugleTheme">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.conversation.ConversationActivity" />
|
||||
</activity>
|
||||
android:theme="@style/BugleTheme"
|
||||
android:parentActivityName="com.android.messaging.ui.conversation.ConversationActivity" />
|
||||
|
||||
<!-- Attachment chooser -->
|
||||
<activity
|
||||
@@ -293,11 +262,7 @@
|
||||
android:screenOrientation="user"
|
||||
android:label="@string/attachment_chooser_activity_title"
|
||||
android:theme="@style/BugleTheme"
|
||||
android:parentActivityName="com.android.messaging.ui.conversation.ConversationActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.android.messaging.ui.conversation.ConversationActivity" />
|
||||
</activity>
|
||||
android:parentActivityName="com.android.messaging.ui.conversation.ConversationActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.debug.DebugMmsConfigActivity"
|
||||
@@ -335,15 +300,6 @@
|
||||
|
||||
<!-- Intents for Notification and Pre-KLP Delivery -->
|
||||
<!-- Registered with the highest possible priority (max_int) -->
|
||||
<receiver android:name=".receiver.MmsWapPushReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
||||
<intent-filter android:priority="2147483647">
|
||||
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
|
||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.SmsReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
@@ -356,26 +312,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Intents for aborting SMS/MMS broadcasts pre-KLP -->
|
||||
<!-- Registered for a priority just ahead of inbox Messaging apps (2) -->
|
||||
<receiver android:name=".receiver.AbortMmsWapPushReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
||||
<intent-filter android:priority="3">
|
||||
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
|
||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.AbortSmsReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BROADCAST_SMS">
|
||||
<intent-filter android:priority="3">
|
||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Intents for KLP+ Delivery -->
|
||||
<receiver android:name=".receiver.MmsWapPushDeliverReceiver"
|
||||
android:exported="true"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/contact_picker_tab_pressed" />
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/fab_ripple" >
|
||||
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/fab_color" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</ripple>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/gallery_image_pressed">
|
||||
<item android:id="@android:id/mask"
|
||||
android:drawable="@android:color/white" />
|
||||
</ripple>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/background_item_pressed" />
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/background_item_pressed" />
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
@@ -14,8 +14,5 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_pressed="true"
|
||||
android:drawable="@color/contact_picker_tab_pressed" />
|
||||
</selector>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/contact_picker_tab_pressed" />
|
||||
@@ -14,32 +14,13 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/fab_ripple" >
|
||||
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/fab_new_message_static_shadow" />
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/fab_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:bottom="@dimen/fab_padding_bottom">
|
||||
<selector>
|
||||
<item
|
||||
android:state_pressed="true">
|
||||
<shape
|
||||
android:shape="oval" >
|
||||
<solid
|
||||
android:color="@color/fab_pressed_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape
|
||||
android:shape="oval" >
|
||||
<solid
|
||||
android:color="@color/fab_color" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
</ripple>
|
||||
@@ -14,10 +14,8 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_pressed="true"
|
||||
android:drawable="@color/gallery_image_pressed" />
|
||||
<item
|
||||
android:drawable="@android:color/transparent" />
|
||||
</selector>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/gallery_image_pressed">
|
||||
<item android:id="@android:id/mask"
|
||||
android:drawable="@android:color/white" />
|
||||
</ripple>
|
||||
|
||||
@@ -14,13 +14,5 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_pressed="true"
|
||||
android:drawable="@color/background_item_pressed" />
|
||||
<item
|
||||
android:state_activated="true"
|
||||
android:drawable="@color/background_item_activated" />
|
||||
<item
|
||||
android:drawable="@color/background_item_transparent" />
|
||||
</selector>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/background_item_pressed" />
|
||||
|
||||
@@ -14,13 +14,5 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_pressed="true"
|
||||
android:drawable="@color/background_item_pressed" />
|
||||
<item
|
||||
android:state_activated="true"
|
||||
android:drawable="@color/background_item_activated" />
|
||||
<item
|
||||
android:drawable="@color/background_item_transparent" />
|
||||
</selector>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/background_item_pressed" />
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<resources>
|
||||
<style name="ComposeMessageViewAttachMediaButtonStyle">
|
||||
<item name="android:paddingStart">@dimen/compose_message_attachment_padding_sides</item>
|
||||
<item name="android:paddingEnd">@dimen/compose_message_attachment_padding_sides</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2024 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +23,7 @@
|
||||
<style name="ComposeMessageViewAttachMediaButtonStyle">
|
||||
<item name="android:paddingStart">@dimen/compose_message_attachment_padding_sides</item>
|
||||
<item name="android:paddingEnd">@dimen/compose_message_attachment_padding_sides</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
|
||||
<style name="ConversationComposeSendText">
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<resources>
|
||||
<style name="GalleryGridItemViewCheckBoxStyle">
|
||||
<item name="android:paddingEnd">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AttachmentGridItemViewCheckBoxStyle">
|
||||
<item name="android:paddingEnd">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PeopleAndOptionsItemStyle">
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AudioAttachmentViewStyle">
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="VcardAttachmentSingleStyle">
|
||||
<item name="android:paddingStart">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/message_text_left_right_padding</item>
|
||||
</style>
|
||||
|
||||
<style name="PeopleListItemViewStyle">
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="MessageVcardAttachmentStyle">
|
||||
<item name="android:paddingStart">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/message_text_left_right_padding</item>
|
||||
</style>
|
||||
|
||||
<style name="CameraChooserFrameStyle">
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AddContactConfirmationTextStyle">
|
||||
<item name="android:paddingStart">12dp</item>
|
||||
<item name="android:paddingEnd">24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ContactListItemDetailType">
|
||||
<item name="android:paddingStart">12dp</item>
|
||||
</style>
|
||||
|
||||
<style name="DebugMmsConfigItemStyle">
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ApnPreferenceLayoutStyle">
|
||||
<item name="android:paddingStart">?android:attr/listPreferredItemPaddingStart</item>
|
||||
<item name="android:paddingEnd">?android:attr/listPreferredItemPaddingEnd</item>
|
||||
</style>
|
||||
|
||||
<style name="CopyContactDialogTextStyle">
|
||||
<item name="android:paddingStart">@dimen/copy_contact_dialog_left_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/copy_contact_dialog_right_padding</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<resources>
|
||||
<color name="notification_sender_text">#DE000000</color>
|
||||
<color name="notification_secondary_text">#8A000000</color>
|
||||
<color name="notification_tertiary_text">#8A000000</color>
|
||||
<color name="notification_subject_color">#DE000000</color>
|
||||
</resources>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="fab_bottom_margin">16dp</dimen>
|
||||
<dimen name="fab_left_right_margin">16dp</dimen>
|
||||
<dimen name="fab_size">56dp</dimen>
|
||||
<dimen name="fab_padding_bottom">0dp</dimen>
|
||||
</resources>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2024 The LineageOS 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.
|
||||
-->
|
||||
<resources>
|
||||
<style name="BugleTheme.ConversationActivity"
|
||||
parent="@style/BugleTheme.ConversationActivityBase">
|
||||
<item name="android:colorEdgeEffect">@color/conversation_edge_effect</item>
|
||||
</style>
|
||||
|
||||
<style name="BugleTheme.DialogActivity" parent="@style/Theme.AppCompat.DayNight.Dialog">
|
||||
<item name="android:windowNoTitle">false</item>
|
||||
<item name="android:background">@color/window_background</item>
|
||||
<item name="android:dialogCornerRadius">28dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ContactListItemDrawableIndicator">
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
|
||||
<style name="ConversationActionBarTitleTextStyle" parent="BugleActionBarTitleTextStyle">
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
|
||||
<style name="WidgetConversationListItemStyle">
|
||||
<item name="android:background">@drawable/widget_item_background</item>
|
||||
<item name="android:layout_height">72dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018 The LineageOS 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.
|
||||
-->
|
||||
<resources>
|
||||
<style name="BugleBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:forceDarkAllowed">true</item>
|
||||
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2024 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -128,13 +129,13 @@
|
||||
|
||||
<color name="contact_picker_hint_text_color">#40000000</color>
|
||||
|
||||
<color name="notification_sender_text">#9A9A9A</color>
|
||||
<color name="notification_secondary_text">#FFFFFF</color>
|
||||
<color name="notification_tertiary_text">#FFFFFF</color>
|
||||
<color name="notification_sender_text">#DE000000</color>
|
||||
<color name="notification_secondary_text">#8A000000</color>
|
||||
<color name="notification_tertiary_text">#8A000000</color>
|
||||
<color name="wearable_notification_participants_count">#a2a2a2</color>
|
||||
<color name="notification_accent_color">@color/primary_color</color>
|
||||
<color name="notification_warning_color">#ff0000</color>
|
||||
<color name="notification_subject_color">#99aaaaaa</color>
|
||||
<color name="notification_subject_color">#DE000000</color>
|
||||
|
||||
<color name="participant_list_text_primary">#4d4d4d</color>
|
||||
<color name="people_and_options_header_text">#6d6d6d</color>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2024 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -112,12 +113,12 @@
|
||||
<dimen name="image_attachment_fallback_width">240dp</dimen>
|
||||
<dimen name="image_attachment_fallback_height">240dp</dimen>
|
||||
|
||||
<dimen name="fab_size">60dp</dimen>
|
||||
<dimen name="fab_padding_bottom">4dp</dimen>
|
||||
<dimen name="fab_size">56dp</dimen>
|
||||
<dimen name="fab_padding_bottom">0dp</dimen>
|
||||
<dimen name="fab_elevation">2dp</dimen>
|
||||
<dimen name="fab_elevation_pressed">6dp</dimen>
|
||||
<dimen name="fab_bottom_margin">12dp</dimen>
|
||||
<dimen name="fab_left_right_margin">14dp</dimen>
|
||||
<dimen name="fab_bottom_margin">16dp</dimen>
|
||||
<dimen name="fab_left_right_margin">16dp</dimen>
|
||||
<dimen name="message_body_size_text_size">12sp</dimen>
|
||||
|
||||
<dimen name="vcard_detail_group_indicator_width">40dp</dimen>
|
||||
|
||||
@@ -17,18 +17,14 @@
|
||||
-->
|
||||
<resources>
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by BugleBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
Base application theme
|
||||
-->
|
||||
<style name="BugleBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
<item name="android:forceDarkAllowed">true</item>
|
||||
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="BugleTheme" parent="BugleBaseTheme">
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
@@ -49,6 +45,7 @@
|
||||
|
||||
<style name="BugleTheme.ConversationActivity"
|
||||
parent="@style/BugleTheme.ConversationActivityBase">
|
||||
<item name="android:colorEdgeEffect">@color/conversation_edge_effect</item>
|
||||
</style>
|
||||
|
||||
<style name="BugleTheme.ConversationActivityBase" parent="BugleTheme">
|
||||
@@ -59,7 +56,10 @@
|
||||
<item name="android:fastScrollPreviewBackgroundRight">@drawable/contacts_fastscroll_label_right</item>
|
||||
</style>
|
||||
|
||||
<style name="BugleTheme.DialogActivity" parent="@style/Theme.AppCompat.Light.Dialog">
|
||||
<style name="BugleTheme.DialogActivity" parent="@style/Theme.AppCompat.DayNight.Dialog">
|
||||
<item name="android:windowNoTitle">false</item>
|
||||
<item name="android:background">@color/window_background</item>
|
||||
<item name="android:dialogCornerRadius">28dp</item>
|
||||
</style>
|
||||
|
||||
<style name="BugleTheme.ConversationListActivity" parent="BugleTheme">
|
||||
@@ -107,7 +107,7 @@
|
||||
</style>
|
||||
|
||||
<style name="ConversationActionBarTitleTextStyle" parent="BugleActionBarTitleTextStyle">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
|
||||
<style name="BuglePhotoViewTheme" parent="PhotoViewTheme.Translucent">
|
||||
@@ -173,12 +173,12 @@
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="ContactListItemDetailType" parent="ContactListItemDetail">
|
||||
<item name="android:paddingLeft">12dp</item>
|
||||
<style name="ContactListItemDetailType">
|
||||
<item name="android:paddingStart">12dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ContactListItemDrawableIndicator">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
|
||||
<style name="RecipientEditTextView">
|
||||
@@ -224,8 +224,8 @@
|
||||
</style>
|
||||
|
||||
<style name="AudioAttachmentViewStyle">
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ContactPickerHintText">
|
||||
@@ -234,13 +234,13 @@
|
||||
</style>
|
||||
|
||||
<style name="VcardAttachmentSingleStyle">
|
||||
<item name="android:paddingRight">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingLeft">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingStart">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/message_text_left_right_padding</item>
|
||||
</style>
|
||||
|
||||
<style name="MessageVcardAttachmentStyle">
|
||||
<item name="android:paddingRight">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingLeft">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingStart">@dimen/message_text_left_right_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/message_text_left_right_padding</item>
|
||||
</style>
|
||||
|
||||
<style name="NotificationSenderText">
|
||||
@@ -265,7 +265,7 @@
|
||||
</style>
|
||||
|
||||
<style name="CameraChooserFrameStyle">
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ComposeMessageViewAttachMediaButtonStyle">
|
||||
@@ -309,7 +309,7 @@
|
||||
</style>
|
||||
|
||||
<style name="GalleryGridItemViewCheckBoxStyle">
|
||||
<item name="android:paddingRight">22dp</item>
|
||||
<item name="android:paddingEnd">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AttachmentPreviewAttachmentStyle">
|
||||
@@ -342,23 +342,23 @@
|
||||
<item name="android:layout_gravity">left|center_vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="AddContactConfirmationTextStyle" parent="ParticipantListItem">
|
||||
<item name="android:paddingLeft">12dp</item>
|
||||
<item name="android:paddingRight">24dp</item>
|
||||
<style name="AddContactConfirmationTextStyle">
|
||||
<item name="android:paddingStart">12dp</item>
|
||||
<item name="android:paddingEnd">24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="CopyContactDialogTextStyle" parent="ParticipantListItem">
|
||||
<item name="android:paddingLeft">@dimen/copy_contact_dialog_left_padding</item>
|
||||
<item name="android:paddingRight">@dimen/copy_contact_dialog_right_padding</item>
|
||||
<style name="CopyContactDialogTextStyle">
|
||||
<item name="android:paddingStart">@dimen/copy_contact_dialog_left_padding</item>
|
||||
<item name="android:paddingEnd">@dimen/copy_contact_dialog_right_padding</item>
|
||||
</style>
|
||||
|
||||
<style name="PeopleListItemViewStyle">
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PeopleAndOptionsItemStyle">
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PeopleAndOptionsSectionHeader">
|
||||
@@ -477,8 +477,8 @@
|
||||
</style>
|
||||
|
||||
<style name="ApnPreferenceLayoutStyle">
|
||||
<item name="android:paddingLeft">?android:attr/listPreferredItemPaddingStart</item>
|
||||
<item name="android:paddingRight">?android:attr/listPreferredItemPaddingEnd</item>
|
||||
<item name="android:paddingStart">?android:attr/listPreferredItemPaddingStart</item>
|
||||
<item name="android:paddingEnd">?android:attr/listPreferredItemPaddingEnd</item>
|
||||
</style>
|
||||
|
||||
<style name="SettingsListItem">
|
||||
@@ -505,8 +505,8 @@
|
||||
</style>
|
||||
|
||||
<style name="DebugMmsConfigItemStyle">
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="WidgetTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
|
||||
@@ -612,11 +612,12 @@
|
||||
</style>
|
||||
|
||||
<style name="WidgetConversationListItemStyle">
|
||||
<item name="android:layout_height">80dp</item>
|
||||
<item name="android:background">@drawable/widget_item_background</item>
|
||||
<item name="android:layout_height">72dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AttachmentGridItemViewCheckBoxStyle">
|
||||
<item name="android:paddingRight">4dp</item>
|
||||
<item name="android:paddingEnd">4dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PromoScreenTextStyle">
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<!-- Preference screen definition for Bugle's application-wide settings -->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- KLP+ only -->
|
||||
<PreferenceScreen
|
||||
android:key="@string/sms_disabled_pref_key"
|
||||
android:title="@string/sms_disabled_pref_title"
|
||||
android:persistent="false">
|
||||
<intent
|
||||
android:action="android.provider.Telephony.ACTION_CHANGE_DEFAULT">
|
||||
<extra android:name="package" android:value="com.android.messaging" />
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen
|
||||
android:key="@string/sms_enabled_pref_key"
|
||||
android:title="@string/sms_enabled_pref_title"
|
||||
android:persistent="false">
|
||||
<intent
|
||||
android:action="android.settings.WIRELESS_SETTINGS">
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/send_sound_pref_key"
|
||||
android:title="@string/send_sound_pref_title"
|
||||
android:defaultValue="@bool/send_sound_pref_default"
|
||||
android:persistent="true" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/notifications_pref_key"
|
||||
android:title="@string/notifications_pref_title"
|
||||
android:persistent="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/swipe_right_deletes_conversation_key"
|
||||
android:title="@string/swipe_to_delete_conversation_pref_title"
|
||||
android:summary="@string/swipe_to_delete_conversation_pref_summary"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="@string/advanced_pref_key"
|
||||
android:title="@string/advanced_settings" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="@string/debug_pref_key"
|
||||
android:title="@string/debug_category_pref_title">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/dump_sms_pref_key"
|
||||
android:title="@string/dump_sms_pref_title"
|
||||
android:summary="@string/dump_sms_pref_summary"
|
||||
android:defaultValue="@bool/dump_sms_pref_default" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/dump_mms_pref_key"
|
||||
android:title="@string/dump_mms_pref_title"
|
||||
android:summary="@string/dump_mms_pref_summary"
|
||||
android:defaultValue="@bool/dump_mms_pref_default" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2024 The LineageOS 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.
|
||||
-->
|
||||
<!-- Preference screen definition for Bugle's subscription-specific settings -->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="@string/mms_messaging_category_pref_key"
|
||||
android:title="@string/mms_messaging_category_pref_title">
|
||||
|
||||
<Preference
|
||||
android:title="@string/group_mms_pref_title"
|
||||
android:key="@string/group_mms_pref_key"/>
|
||||
|
||||
<com.android.messaging.ui.appsettings.PhoneNumberPreference
|
||||
android:key="@string/mms_phone_number_pref_key"
|
||||
android:title="@string/mms_phone_number_pref_title" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/auto_retrieve_mms_pref_key"
|
||||
android:title="@string/auto_retrieve_mms_pref_title"
|
||||
android:summary="@string/auto_retrieve_mms_pref_summary"
|
||||
android:defaultValue="@bool/auto_retrieve_mms_pref_default" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/auto_retrieve_mms_when_roaming_pref_key"
|
||||
android:dependency="@string/auto_retrieve_mms_pref_key"
|
||||
android:title="@string/auto_retrieve_mms_when_roaming_pref_title"
|
||||
android:summary="@string/auto_retrieve_mms_when_roaming_pref_summary"
|
||||
android:defaultValue="@bool/auto_retrieve_mms_when_roaming_pref_default" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="@string/advanced_category_pref_key"
|
||||
android:title="@string/advanced_category_pref_title">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/delivery_reports_pref_key"
|
||||
android:title="@string/delivery_reports_pref_title"
|
||||
android:summary="@string/delivery_reports_pref_summary"
|
||||
android:defaultValue="@bool/delivery_reports_pref_default" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="@string/sms_apns_key"
|
||||
android:title="@string/sms_apns_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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.
|
||||
-->
|
||||
<!-- Preference screen definition for Bugle's application-wide settings -->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- KLP+ only -->
|
||||
<PreferenceScreen
|
||||
android:key="@string/sms_disabled_pref_key"
|
||||
android:title="@string/sms_disabled_pref_title"
|
||||
android:persistent="false">
|
||||
<intent
|
||||
android:action="android.provider.Telephony.ACTION_CHANGE_DEFAULT">
|
||||
<extra android:name="package" android:value="com.android.messaging" />
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
<!-- MNC+ only -->
|
||||
<PreferenceScreen
|
||||
android:key="@string/sms_enabled_pref_key"
|
||||
android:title="@string/sms_enabled_pref_title"
|
||||
android:persistent="false">
|
||||
<intent
|
||||
android:action="android.provider.Telephony.ACTION_CHANGE_DEFAULT">
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/send_sound_pref_key"
|
||||
android:title="@string/send_sound_pref_title"
|
||||
android:defaultValue="@bool/send_sound_pref_default"
|
||||
android:persistent="true" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/notifications_pref_key"
|
||||
android:title="@string/notifications_pref_title"
|
||||
android:persistent="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/swipe_right_deletes_conversation_key"
|
||||
android:title="@string/swipe_to_delete_conversation_pref_title"
|
||||
android:summary="@string/swipe_to_delete_conversation_pref_summary"
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="@string/advanced_pref_key"
|
||||
android:title="@string/advanced_settings" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="@string/debug_pref_key"
|
||||
android:title="@string/debug_category_pref_title">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/dump_sms_pref_key"
|
||||
android:title="@string/dump_sms_pref_title"
|
||||
android:summary="@string/dump_sms_pref_summary"
|
||||
android:defaultValue="@bool/dump_sms_pref_default" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/dump_mms_pref_key"
|
||||
android:title="@string/dump_mms_pref_title"
|
||||
android:summary="@string/dump_mms_pref_summary"
|
||||
android:defaultValue="@bool/dump_mms_pref_default" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -32,7 +32,7 @@
|
||||
android:title="@string/sms_enabled_pref_title"
|
||||
android:persistent="false">
|
||||
<intent
|
||||
android:action="android.settings.WIRELESS_SETTINGS">
|
||||
android:action="android.provider.Telephony.ACTION_CHANGE_DEFAULT">
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ class DefaultApnSettingsLoader implements ApnSettingsLoader {
|
||||
*/
|
||||
private void loadFromSystem(final int subId, final String apnName, final List<Apn> apns) {
|
||||
Uri uri;
|
||||
if (Utils.supportMSim() && subId != MmsManager.DEFAULT_SUB_ID) {
|
||||
if (subId != MmsManager.DEFAULT_SUB_ID) {
|
||||
uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "/subId/" + subId);
|
||||
} else {
|
||||
uri = Telephony.Carriers.CONTENT_URI;
|
||||
|
||||
@@ -68,12 +68,8 @@ class DefaultCarrierConfigValuesLoader implements CarrierConfigValuesLoader {
|
||||
}
|
||||
|
||||
private void loadLocked(final int subId, final Bundle values) {
|
||||
// For K and earlier, load from resources
|
||||
loadFromResources(subId, values);
|
||||
if (Utils.hasMmsApi()) {
|
||||
// For L and later, also load from system MMS service
|
||||
loadFromSystem(subId, values);
|
||||
}
|
||||
loadFromSystem(subId, values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,13 +72,11 @@ class DefaultUserAgentInfoLoader implements UserAgentInfoLoader {
|
||||
}
|
||||
|
||||
private void loadLocked() {
|
||||
if (Utils.hasUserAgentApi()) {
|
||||
// load the MMS User agent and UaProfUrl from TelephonyManager APIs
|
||||
final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
mUserAgent = telephonyManager.getMmsUserAgent();
|
||||
mUAProfUrl = telephonyManager.getMmsUAProfUrl();
|
||||
}
|
||||
// load the MMS User agent and UaProfUrl from TelephonyManager APIs
|
||||
final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
mUserAgent = telephonyManager.getMmsUserAgent();
|
||||
mUAProfUrl = telephonyManager.getMmsUAProfUrl();
|
||||
if (TextUtils.isEmpty(mUserAgent)) {
|
||||
mUserAgent = DEFAULT_USER_AGENT;
|
||||
}
|
||||
|
||||
@@ -392,17 +392,13 @@ public class MmsHttpClient {
|
||||
* @return the phone number text
|
||||
*/
|
||||
private String getSelfNumber() {
|
||||
if (Utils.supportMSim()) {
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(mContext);
|
||||
final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(
|
||||
SmsManager.getDefaultSmsSubscriptionId());
|
||||
if (info != null) {
|
||||
return info.getNumber();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(mContext);
|
||||
final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(
|
||||
SmsManager.getDefaultSmsSubscriptionId());
|
||||
if (info != null) {
|
||||
return info.getNumber();
|
||||
} else {
|
||||
return mTelephonyManager.getLine1Number();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,15 +409,11 @@ public class MmsHttpClient {
|
||||
*/
|
||||
private String getSimOrLocaleCountry() {
|
||||
String country = null;
|
||||
if (Utils.supportMSim()) {
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(mContext);
|
||||
final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(
|
||||
SmsManager.getDefaultSmsSubscriptionId());
|
||||
if (info != null) {
|
||||
country = info.getCountryIso();
|
||||
}
|
||||
} else {
|
||||
country = mTelephonyManager.getSimCountryIso();
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(mContext);
|
||||
final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(
|
||||
SmsManager.getDefaultSmsSubscriptionId());
|
||||
if (info != null) {
|
||||
country = info.getCountryIso();
|
||||
}
|
||||
if (!TextUtils.isEmpty(country)) {
|
||||
return country.toUpperCase();
|
||||
@@ -439,13 +431,8 @@ public class MmsHttpClient {
|
||||
* @return the Base64 encoded NAI string to use as HTTP header
|
||||
*/
|
||||
private String getEncodedNai(final String naiSuffix) {
|
||||
String nai;
|
||||
if (Utils.supportMSim()) {
|
||||
nai = getNaiBySystemApi(
|
||||
getSlotId(Utils.getEffectiveSubscriptionId(MmsManager.DEFAULT_SUB_ID)));
|
||||
} else {
|
||||
nai = getNaiBySystemProperty();
|
||||
}
|
||||
String nai = getNaiBySystemApi(
|
||||
getSlotId(Utils.getEffectiveSubscriptionId(MmsManager.DEFAULT_SUB_ID)));
|
||||
if (!TextUtils.isEmpty(nai)) {
|
||||
Log.i(MmsService.TAG, "NAI is not empty");
|
||||
if (!TextUtils.isEmpty(naiSuffix)) {
|
||||
|
||||
@@ -175,7 +175,7 @@ public class MmsManager {
|
||||
* @return true if forced to use legacy APIs or platform doesn't supports MMS APIs.
|
||||
*/
|
||||
public static boolean shouldUseLegacyMms() {
|
||||
return sForceLegacyMms || !Utils.hasMmsApi();
|
||||
return sForceLegacyMms;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,10 +187,6 @@ public class MmsManager {
|
||||
* @return a Bundle containing the overrides
|
||||
*/
|
||||
private static Bundle getConfigOverrides(final int subId) {
|
||||
if (!Utils.hasMmsApi()) {
|
||||
// If MMS API is not present, it is not necessary to compute overrides
|
||||
return null;
|
||||
}
|
||||
Bundle overrides = null;
|
||||
synchronized (sConfigOverridesMap) {
|
||||
overrides = sConfigOverridesMap.get(subId);
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -350,16 +349,7 @@ class MmsNetworkManager {
|
||||
* @return The change's network type
|
||||
*/
|
||||
private static int getConnectivityChangeNetworkType(final Intent intent) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
return intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, TYPE_NONE);
|
||||
} else {
|
||||
final NetworkInfo info = intent.getParcelableExtra(
|
||||
ConnectivityManager.EXTRA_NETWORK_INFO);
|
||||
if (info != null) {
|
||||
return info.getType();
|
||||
}
|
||||
}
|
||||
return TYPE_NONE;
|
||||
return intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, TYPE_NONE);
|
||||
}
|
||||
|
||||
private static String getMmsConnectivityResultString(int result) {
|
||||
|
||||
@@ -19,11 +19,9 @@ package android.support.v7.mms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.telephony.SmsManager;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -34,33 +32,6 @@ import java.net.URL;
|
||||
* Utility methods
|
||||
*/
|
||||
class Utils {
|
||||
/**
|
||||
* Check if MMS API is available
|
||||
*
|
||||
* @return true if MMS API is available, false otherwise
|
||||
*/
|
||||
static boolean hasMmsApi() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if support multi-SIM
|
||||
*
|
||||
* @return true if MSIM is supported, false otherwise
|
||||
*/
|
||||
static boolean supportMSim() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if support APIs for getting UserAgent and UAProfUrl
|
||||
*
|
||||
* @return true if those APIs are supported, false otherwise
|
||||
*/
|
||||
static boolean hasUserAgentApi() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system SmsManager
|
||||
*
|
||||
@@ -68,11 +39,7 @@ class Utils {
|
||||
* @return the SmsManager for the input subId
|
||||
*/
|
||||
static SmsManager getSmsManager(final int subId) {
|
||||
if (supportMSim()) {
|
||||
return SmsManager.getSmsManagerForSubscriptionId(subId);
|
||||
} else {
|
||||
return SmsManager.getDefault();
|
||||
}
|
||||
return SmsManager.getSmsManagerForSubscriptionId(subId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,10 +49,8 @@ class Utils {
|
||||
* @return the default SMS subscription ID if the input is -1, otherwise the original
|
||||
*/
|
||||
static int getEffectiveSubscriptionId(int subId) {
|
||||
if (supportMSim()) {
|
||||
if (subId == MmsManager.DEFAULT_SUB_ID) {
|
||||
subId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
if (subId == MmsManager.DEFAULT_SUB_ID) {
|
||||
subId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
if (subId < 0) {
|
||||
subId = MmsManager.DEFAULT_SUB_ID;
|
||||
@@ -102,25 +67,11 @@ class Utils {
|
||||
*/
|
||||
static int[] getMccMnc(final Context context, final int subId) {
|
||||
final int[] mccMnc = new int[] { 0, 0 };
|
||||
if (Utils.supportMSim()) {
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
|
||||
final SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId);
|
||||
if (subInfo != null) {
|
||||
mccMnc[0] = subInfo.getMcc();
|
||||
mccMnc[1] = subInfo.getMnc();
|
||||
}
|
||||
} else {
|
||||
final TelephonyManager telephonyManager =
|
||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
final String mccMncString = telephonyManager.getSimOperator();
|
||||
try {
|
||||
mccMnc[0] = Integer.parseInt(mccMncString.substring(0, 3));
|
||||
mccMnc[1] = Integer.parseInt(mccMncString.substring(3));
|
||||
} catch (Exception e) {
|
||||
Log.w(MmsService.TAG, "Invalid mcc/mnc from system " + mccMncString + ": " + e);
|
||||
mccMnc[0] = 0;
|
||||
mccMnc[1] = 0;
|
||||
}
|
||||
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
|
||||
final SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId);
|
||||
if (subInfo != null) {
|
||||
mccMnc[0] = subInfo.getMcc();
|
||||
mccMnc[1] = subInfo.getMnc();
|
||||
}
|
||||
return mccMnc;
|
||||
}
|
||||
@@ -133,9 +84,6 @@ class Utils {
|
||||
* @return the sub-dependent Context
|
||||
*/
|
||||
static Context getSubDepContext(final Context context, final int subId) {
|
||||
if (!supportMSim()) {
|
||||
return context;
|
||||
}
|
||||
final int[] mccMnc = getMccMnc(context, subId);
|
||||
final int mcc = mccMnc[0];
|
||||
final int mnc = mccMnc[1];
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.android.messaging.util.BuglePrefs;
|
||||
import com.android.messaging.util.BuglePrefsKeys;
|
||||
import com.android.messaging.util.DebugUtils;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.Trace;
|
||||
|
||||
@@ -99,9 +98,7 @@ public class BugleApplication extends Application implements UncaughtExceptionHa
|
||||
// Fixup messages in flight if we crashed and send any pending
|
||||
dataModel.onApplicationCreated();
|
||||
// Register carrier config change receiver
|
||||
if (OsUtil.isAtLeastM()) {
|
||||
registerCarrierConfigChangeReceiver(context);
|
||||
}
|
||||
registerCarrierConfigChangeReceiver(context);
|
||||
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@@ -64,9 +64,6 @@ class FactoryImpl extends Factory {
|
||||
private SparseArray<BugleSubscriptionPrefs> mSubscriptionPrefs;
|
||||
private BugleCarrierConfigValuesLoader mCarrierConfigValuesLoader;
|
||||
|
||||
// Cached instance for Pre-L_MR1
|
||||
private static final Object PHONEUTILS_INSTANCE_LOCK = new Object();
|
||||
private static PhoneUtils sPhoneUtilsInstancePreLMR1 = null;
|
||||
// Cached subId->instance for L_MR1 and beyond
|
||||
private static final ConcurrentHashMap<Integer, PhoneUtils> sPhoneUtilsInstanceCacheLMR1 =
|
||||
new ConcurrentHashMap<>();
|
||||
@@ -197,31 +194,19 @@ class FactoryImpl extends Factory {
|
||||
|
||||
@Override
|
||||
public PhoneUtils getPhoneUtils(int subId) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
if (subId == ParticipantData.DEFAULT_SELF_SUB_ID) {
|
||||
subId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
if (subId < 0) {
|
||||
LogUtil.w(LogUtil.BUGLE_TAG, "PhoneUtils.getForLMR1(): invalid subId = " + subId);
|
||||
subId = ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
PhoneUtils instance = sPhoneUtilsInstanceCacheLMR1.get(subId);
|
||||
if (instance == null) {
|
||||
instance = new PhoneUtils.PhoneUtilsLMR1(subId);
|
||||
sPhoneUtilsInstanceCacheLMR1.putIfAbsent(subId, instance);
|
||||
}
|
||||
return instance;
|
||||
} else {
|
||||
Assert.isTrue(subId == ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
if (sPhoneUtilsInstancePreLMR1 == null) {
|
||||
synchronized (PHONEUTILS_INSTANCE_LOCK) {
|
||||
if (sPhoneUtilsInstancePreLMR1 == null) {
|
||||
sPhoneUtilsInstancePreLMR1 = new PhoneUtils.PhoneUtilsPreLMR1();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sPhoneUtilsInstancePreLMR1;
|
||||
if (subId == ParticipantData.DEFAULT_SELF_SUB_ID) {
|
||||
subId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
if (subId < 0) {
|
||||
LogUtil.w(LogUtil.BUGLE_TAG, "PhoneUtils.getForLMR1(): invalid subId = " + subId);
|
||||
subId = ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
PhoneUtils instance = sPhoneUtilsInstanceCacheLMR1.get(subId);
|
||||
if (instance == null) {
|
||||
instance = new PhoneUtils(subId);
|
||||
sPhoneUtilsInstanceCacheLMR1.putIfAbsent(subId, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.AvatarUriUtil;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.UriUtil;
|
||||
import com.android.messaging.widget.WidgetConversationProvider;
|
||||
@@ -567,7 +566,7 @@ public class BugleDatabaseOperations {
|
||||
// reading and if necessary creating the conversation.
|
||||
updateConversationRow(dbWrapper, conversationId, values);
|
||||
|
||||
if (shouldAutoSwitchSelfId && OsUtil.isAtLeastL_MR1()) {
|
||||
if (shouldAutoSwitchSelfId) {
|
||||
// Normally, the draft message compose UI trusts its UI state for providing up-to-date
|
||||
// conversation self id. Therefore, notify UI through local broadcast receiver about
|
||||
// this external change so the change can be properly reflected.
|
||||
@@ -624,7 +623,7 @@ public class BugleDatabaseOperations {
|
||||
static boolean addSelfIdAutoSwitchInfoToContentValues(final DatabaseWrapper dbWrapper,
|
||||
final MessageData message, final String conversationId, final ContentValues values) {
|
||||
// Only auto switch conversation self for incoming messages.
|
||||
if (!OsUtil.isAtLeastL_MR1() || !message.getIsIncoming()) {
|
||||
if (!message.getIsIncoming()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.NotificationPlayer;
|
||||
import com.android.messaging.util.NotificationsUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PendingIntentConstants;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.ThreadUtil;
|
||||
@@ -429,7 +428,7 @@ public class BugleNotifications {
|
||||
if (state.mParticipantAvatarsUris != null) {
|
||||
final Uri avatarUri = state.mParticipantAvatarsUris.get(0);
|
||||
final AvatarRequestDescriptor descriptor = new AvatarRequestDescriptor(avatarUri,
|
||||
sIconWidth, sIconHeight, OsUtil.isAtLeastL());
|
||||
sIconWidth, sIconHeight, true);
|
||||
final MediaRequest<ImageResource> imageRequest = descriptor.buildSyncMediaRequest(
|
||||
context);
|
||||
|
||||
@@ -676,7 +675,6 @@ public class BugleNotifications {
|
||||
|
||||
MediaRequest<ImageResource> imageRequest;
|
||||
if (isVideo) {
|
||||
Assert.isTrue(VideoThumbnailRequest.shouldShowIncomingVideoThumbnails());
|
||||
final MessagePartVideoThumbnailRequestDescriptor videoDescriptor =
|
||||
new MessagePartVideoThumbnailRequestDescriptor(attachmentUri);
|
||||
imageRequest = videoDescriptor.buildSyncMediaRequest(context);
|
||||
|
||||
@@ -54,7 +54,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.ConnectivityUtil;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -66,8 +65,6 @@ public class DataModelImpl extends DataModel {
|
||||
private final DatabaseHelper mDatabaseHelper;
|
||||
private final SyncManager mSyncManager;
|
||||
|
||||
// Cached ConnectivityUtil instance for Pre-N.
|
||||
private static ConnectivityUtil sConnectivityUtilInstanceCachePreN = null;
|
||||
// Cached ConnectivityUtil subId->instance for N and beyond
|
||||
private static final ConcurrentHashMap<Integer, ConnectivityUtil>
|
||||
sConnectivityUtilInstanceCacheN = new ConcurrentHashMap<>();
|
||||
@@ -214,35 +211,27 @@ public class DataModelImpl extends DataModel {
|
||||
|
||||
@Override
|
||||
public void onApplicationCreated() {
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
createConnectivityUtilForEachActiveSubscription();
|
||||
} else {
|
||||
sConnectivityUtilInstanceCachePreN = new ConnectivityUtil(mContext);
|
||||
}
|
||||
createConnectivityUtilForEachActiveSubscription();
|
||||
|
||||
FixupMessageStatusOnStartupAction.fixupMessageStatus();
|
||||
ProcessPendingMessagesAction.processFirstPendingMessage();
|
||||
SyncManager.immediateSync();
|
||||
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
// Start listening for subscription change events for refreshing any data associated
|
||||
// with subscriptions.
|
||||
PhoneUtils.getDefault().toLMr1().registerOnSubscriptionsChangedListener(
|
||||
new SubscriptionManager.OnSubscriptionsChangedListener() {
|
||||
@Override
|
||||
public void onSubscriptionsChanged() {
|
||||
// TODO: This dynamically changes the mms config that app is
|
||||
// currently using. It may cause inconsistency in some cases. We need
|
||||
// to check the usage of mms config and handle the dynamic change
|
||||
// gracefully
|
||||
MmsConfig.loadAsync();
|
||||
ParticipantRefresh.refreshSelfParticipants();
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
createConnectivityUtilForEachActiveSubscription();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// Start listening for subscription change events for refreshing any data associated
|
||||
// with subscriptions.
|
||||
PhoneUtils.getDefault().registerOnSubscriptionsChangedListener(
|
||||
new SubscriptionManager.OnSubscriptionsChangedListener() {
|
||||
@Override
|
||||
public void onSubscriptionsChanged() {
|
||||
// TODO: This dynamically changes the mms config that app is
|
||||
// currently using. It may cause inconsistency in some cases. We need
|
||||
// to check the usage of mms config and handle the dynamic change
|
||||
// gracefully
|
||||
MmsConfig.loadAsync();
|
||||
ParticipantRefresh.refreshSelfParticipants();
|
||||
createConnectivityUtilForEachActiveSubscription();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createConnectivityUtilForEachActiveSubscription() {
|
||||
@@ -262,10 +251,6 @@ public class DataModelImpl extends DataModel {
|
||||
}
|
||||
|
||||
public static ConnectivityUtil getConnectivityUtil(final int subId) {
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
return sConnectivityUtilInstanceCacheN.get(subId);
|
||||
} else {
|
||||
return sConnectivityUtilInstanceCachePreN;
|
||||
}
|
||||
return sConnectivityUtilInstanceCacheN.get(subId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.provider.ContactsContract.Contacts;
|
||||
import com.android.messaging.util.FallbackStrategies;
|
||||
import com.android.messaging.util.FallbackStrategies.Strategy;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Helper for querying frequent (and/or starred) contacts.
|
||||
@@ -90,9 +89,7 @@ public class FrequentContactsCursorQueryData extends CursorQueryData {
|
||||
// queries. Using strequent_phone_only query as a fallback to display only phone
|
||||
// contacts. This is the last-ditch effort; if this fails, we will display an
|
||||
// empty frequent list (b/18354836).
|
||||
final String strequentQueryParam = OsUtil.isAtLeastL() ?
|
||||
ContactsContract.STREQUENT_PHONE_ONLY : "strequent_phone_only";
|
||||
// TODO: Handle enterprise contacts post M once contacts provider supports it
|
||||
final String strequentQueryParam = ContactsContract.STREQUENT_PHONE_ONLY;
|
||||
return Contacts.CONTENT_STREQUENT_URI.buildUpon()
|
||||
.appendQueryParameter(strequentQueryParam, "true").build();
|
||||
}
|
||||
|
||||
@@ -519,8 +519,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
|
||||
if (messageCount == 1) {
|
||||
final boolean shouldShowImage = ContentType.isImageType(mAttachmentType)
|
||||
|| (ContentType.isVideoType(mAttachmentType)
|
||||
&& VideoThumbnailRequest.shouldShowIncomingVideoThumbnails());
|
||||
|| (ContentType.isVideoType(mAttachmentType));
|
||||
if (mAttachmentUri != null && shouldShowImage) {
|
||||
// Show "Picture" as the content
|
||||
final MessageLineInfo messageLineInfo = (MessageLineInfo) lineInfos.get(0);
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.android.messaging.datamodel.data.ConversationMessageData;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.widget.BugleWidgetProvider;
|
||||
import com.android.messaging.widget.WidgetConversationProvider;
|
||||
@@ -448,11 +447,7 @@ public class MessagingContentProvider extends ContentProvider {
|
||||
// First dump out the default SMS app package name
|
||||
String defaultSmsApp = PhoneUtils.getDefault().getDefaultSmsApp();
|
||||
if (TextUtils.isEmpty(defaultSmsApp)) {
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
defaultSmsApp = "None";
|
||||
} else {
|
||||
defaultSmsApp = "None (pre-Kitkat)";
|
||||
}
|
||||
defaultSmsApp = "None";
|
||||
}
|
||||
writer.println("Default SMS app: " + defaultSmsApp);
|
||||
// Now dump logs
|
||||
|
||||
@@ -353,14 +353,10 @@ public class ParticipantRefresh {
|
||||
* that any other older SIM self participants are marked as inactive.
|
||||
*/
|
||||
private static void refreshSelfParticipantList() {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||
|
||||
final List<SubscriptionInfo> subInfoRecords =
|
||||
PhoneUtils.getDefault().toLMr1().getActiveSubscriptionInfoList();
|
||||
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
|
||||
final ArrayMap<Integer, SubscriptionInfo> activeSubscriptionIdToRecordMap =
|
||||
new ArrayMap<Integer, SubscriptionInfo>();
|
||||
db.beginTransaction();
|
||||
@@ -445,13 +441,11 @@ public class ParticipantRefresh {
|
||||
changed = SELF_PHONE_NUMBER_OR_SUBSCRIPTION_CHANGED;
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
// Refresh the subscription info based on information from SubscriptionManager.
|
||||
final SubscriptionInfo subscriptionInfo =
|
||||
PhoneUtils.get(participantData.getSubId()).toLMr1().getActiveSubscriptionInfo();
|
||||
if (participantData.updateSubscriptionInfoForSelfIfChanged(subscriptionInfo)) {
|
||||
changed = SELF_PHONE_NUMBER_OR_SUBSCRIPTION_CHANGED;
|
||||
}
|
||||
// Refresh the subscription info based on information from SubscriptionManager.
|
||||
final SubscriptionInfo subscriptionInfo =
|
||||
PhoneUtils.get(participantData.getSubId()).getActiveSubscriptionInfo();
|
||||
if (participantData.updateSubscriptionInfoForSelfIfChanged(subscriptionInfo)) {
|
||||
changed = SELF_PHONE_NUMBER_OR_SUBSCRIPTION_CHANGED;
|
||||
}
|
||||
|
||||
// For self participant, try getting name/avatar from self profile in CP2 first.
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -225,8 +224,7 @@ public class InsertNewMessageAction extends Action implements Parcelable {
|
||||
// to bind the message to the system default subscription if it's unbound.
|
||||
final ParticipantData unboundSelf = BugleDatabaseOperations.getExistingParticipant(
|
||||
db, selfId);
|
||||
if (unboundSelf.getSubId() == ParticipantData.DEFAULT_SELF_SUB_ID
|
||||
&& OsUtil.isAtLeastL_MR1()) {
|
||||
if (unboundSelf.getSubId() == ParticipantData.DEFAULT_SELF_SUB_ID) {
|
||||
final int defaultSubId = PhoneUtils.getDefault().getDefaultSmsSubscriptionId();
|
||||
self = BugleDatabaseOperations.getOrCreateSelf(db, defaultSubId);
|
||||
} else {
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.messaging.util.BuglePrefsKeys;
|
||||
import com.android.messaging.util.ConnectivityUtil;
|
||||
import com.android.messaging.util.ConnectivityUtil.ConnectivityListener;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -356,12 +355,10 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
|
||||
|
||||
// Prior to L_MR1, isActiveSubscription is true always
|
||||
boolean isActiveSubscription = true;
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
final ParticipantData messageSelf =
|
||||
BugleDatabaseOperations.getExistingParticipant(db, selfId);
|
||||
if (messageSelf == null || !messageSelf.isActiveSubscription()) {
|
||||
isActiveSubscription = false;
|
||||
}
|
||||
final ParticipantData messageSelf =
|
||||
BugleDatabaseOperations.getExistingParticipant(db, selfId);
|
||||
if (messageSelf == null || !messageSelf.isActiveSubscription()) {
|
||||
isActiveSubscription = false;
|
||||
}
|
||||
while (cursor.moveToNext()) {
|
||||
final MessageData message = new MessageData();
|
||||
|
||||
@@ -51,7 +51,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.RunsOnMainThread;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
import com.android.messaging.widget.WidgetConversationProvider;
|
||||
@@ -595,7 +594,7 @@ public class ConversationData extends BindableData {
|
||||
Assert.isTrue(TextUtils.equals(mConversationId, message.getConversationId()));
|
||||
Assert.isTrue(binding.getData() == this);
|
||||
|
||||
if (!OsUtil.isAtLeastL_MR1() || message.getSelfId() == null) {
|
||||
if (message.getSelfId() == null) {
|
||||
InsertNewMessageAction.insertNewMessage(message);
|
||||
} else {
|
||||
final int systemDefaultSubId = PhoneUtils.getDefault().getDefaultSmsSubscriptionId();
|
||||
@@ -767,8 +766,7 @@ public class ConversationData extends BindableData {
|
||||
// 1. Framework has MSIM support AND
|
||||
// 2. The device has had multiple *active* subscriptions. AND
|
||||
// 3. The message's subscription is active.
|
||||
if (OsUtil.isAtLeastL_MR1() &&
|
||||
selfParticipantsData.getSelfParticipantsCountExcludingDefault(true) > 1) {
|
||||
if (selfParticipantsData.getSelfParticipantsCountExcludingDefault(true) > 1) {
|
||||
return subscriptionListData.getActiveSubscriptionEntryBySelfId(selfParticipantId,
|
||||
excludeDefault);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* A class that contains the list of all self participants potentially involved in a conversation.
|
||||
* This class contains both active/inactive self entries when there is multi-SIM support.
|
||||
@@ -86,9 +84,6 @@ public class SelfParticipantsData {
|
||||
* Returns if a given self id represents the default self.
|
||||
*/
|
||||
boolean isDefaultSelf(final String selfId) {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return true;
|
||||
}
|
||||
final ParticipantData self = getSelfParticipantById(selfId);
|
||||
return self == null ? false : self.getSubId() == ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.android.messaging.datamodel.binding.BindableData;
|
||||
import com.android.messaging.datamodel.binding.BindingBase;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -200,7 +199,7 @@ public class SettingsData extends BindableData implements
|
||||
// platorm is at least L-MR1 and there are multiple active SIMs.
|
||||
final int activeSubCountExcludingDefault =
|
||||
mSelfParticipantsData.getSelfParticipantsCountExcludingDefault(true);
|
||||
if (OsUtil.isAtLeastL_MR1() && activeSubCountExcludingDefault > 0) {
|
||||
if (activeSubCountExcludingDefault > 0) {
|
||||
for (ParticipantData self : selfs) {
|
||||
if (!self.isDefaultSelf()) {
|
||||
if (activeSubCountExcludingDefault > 1) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +25,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -109,11 +109,7 @@ public class DecodedImageResource extends ImageResource {
|
||||
acquireLock();
|
||||
try {
|
||||
Assert.notNull(mBitmap);
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
return mBitmap.getAllocationByteCount();
|
||||
} else {
|
||||
return mBitmap.getRowBytes() * mBitmap.getHeight();
|
||||
}
|
||||
return mBitmap.getAllocationByteCount();
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +21,6 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.android.messaging.util.MediaMetadataRetrieverWrapper;
|
||||
import com.android.messaging.util.MediaUtil;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -28,7 +28,6 @@ import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Class to request a video thumbnail.
|
||||
* Users of this class as responsible for checking {@link #shouldShowIncomingVideoThumbnails}
|
||||
*/
|
||||
public class VideoThumbnailRequest extends ImageRequest<UriImageRequestDescriptor> {
|
||||
|
||||
@@ -37,10 +36,6 @@ public class VideoThumbnailRequest extends ImageRequest<UriImageRequestDescripto
|
||||
super(context, descriptor);
|
||||
}
|
||||
|
||||
public static boolean shouldShowIncomingVideoThumbnails() {
|
||||
return MediaUtil.canAutoAccessIncomingMedia();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getInputStreamForResource() throws FileNotFoundException {
|
||||
return null;
|
||||
|
||||
@@ -39,7 +39,6 @@ import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.mmslib.InvalidHeaderValueException;
|
||||
import com.android.messaging.mmslib.MmsException;
|
||||
import com.android.messaging.mmslib.SqliteWrapper;
|
||||
@@ -51,7 +50,6 @@ import com.android.messaging.sms.MmsSmsUtils;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UriUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -1481,15 +1479,8 @@ public class PduPersister {
|
||||
}
|
||||
// Record whether this mms message is a simple plain text or not. This is a hint for the
|
||||
// UI.
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
values.put(Mms.TEXT_ONLY, textOnly ? 1 : 0);
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
values.put(Mms.SUBSCRIPTION_ID, subId);
|
||||
} else {
|
||||
Assert.equals(ParticipantData.DEFAULT_SELF_SUB_ID, subId);
|
||||
}
|
||||
values.put(Mms.TEXT_ONLY, textOnly ? 1 : 0);
|
||||
values.put(Mms.SUBSCRIPTION_ID, subId);
|
||||
|
||||
Uri res = null;
|
||||
if (existingUri) {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.messaging.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Telephony;
|
||||
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
/**
|
||||
* This receiver is used to abort MMS WAP broadcasts pre-KLP when SMS is enabled.
|
||||
*/
|
||||
public class AbortMmsWapPushReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
if (Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction())
|
||||
&& ContentType.MMS_MESSAGE.equals(intent.getType())) {
|
||||
// If we are enabled, it's our job to stop the broadcast from continuing. This
|
||||
// receiver is not used on KLP but we do an extra check here just to make sure.
|
||||
if (!OsUtil.isAtLeastKLP() && PhoneUtils.getDefault().isSmsEnabled()) {
|
||||
abortBroadcast();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.messaging.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
/**
|
||||
* This receiver is used to abort SMS broadcasts pre-KLP when SMS is enabled.
|
||||
*/
|
||||
public final class AbortSmsReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
// If we are enabled, it's our job to stop the broadcast from continuing. This
|
||||
// receiver is not used on KLP but we do an extra check here just to make sure.
|
||||
if (!OsUtil.isAtLeastKLP() && PhoneUtils.getDefault().isSmsEnabled()) {
|
||||
if (!SmsReceiver.shouldIgnoreMessage(intent)) {
|
||||
abortBroadcast();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Telephony;
|
||||
|
||||
import com.android.messaging.datamodel.action.ReceiveMmsMessageAction;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
@@ -29,15 +31,27 @@ import com.android.messaging.util.PhoneUtils;
|
||||
*/
|
||||
public class MmsWapPushDeliverReceiver extends BroadcastReceiver {
|
||||
|
||||
static final String EXTRA_SUBSCRIPTION = "subscription";
|
||||
static final String EXTRA_DATA = "data";
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
if (Telephony.Sms.Intents.WAP_PUSH_DELIVER_ACTION.equals(intent.getAction())
|
||||
&& ContentType.MMS_MESSAGE.equals(intent.getType())) {
|
||||
// Always convert negative subIds into -1
|
||||
int subId = PhoneUtils.getDefault().getEffectiveIncomingSubIdFromSystem(
|
||||
intent, MmsWapPushReceiver.EXTRA_SUBSCRIPTION);
|
||||
byte[] data = intent.getByteArrayExtra(MmsWapPushReceiver.EXTRA_DATA);
|
||||
MmsWapPushReceiver.mmsReceived(subId, data);
|
||||
intent, EXTRA_SUBSCRIPTION);
|
||||
byte[] data = intent.getByteArrayExtra(EXTRA_DATA);
|
||||
mmsReceived(subId, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void mmsReceived(final int subId, final byte[] data) {
|
||||
if (!PhoneUtils.getDefault().isSmsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ReceiveMmsMessageAction action = new ReceiveMmsMessageAction(subId, data);
|
||||
action.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.messaging.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Telephony;
|
||||
|
||||
import com.android.messaging.datamodel.action.ReceiveMmsMessageAction;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
/**
|
||||
* Class that handles MMS WAP push intent from telephony on pre-KLP Devices.
|
||||
*/
|
||||
public class MmsWapPushReceiver extends BroadcastReceiver {
|
||||
static final String EXTRA_SUBSCRIPTION = "subscription";
|
||||
static final String EXTRA_DATA = "data";
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
if (Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction())
|
||||
&& ContentType.MMS_MESSAGE.equals(intent.getType())) {
|
||||
if (PhoneUtils.getDefault().isSmsEnabled()) {
|
||||
// Always convert negative subIds into -1
|
||||
final int subId = PhoneUtils.getDefault().getEffectiveIncomingSubIdFromSystem(
|
||||
intent, MmsWapPushReceiver.EXTRA_SUBSCRIPTION);
|
||||
final byte[] data = intent.getByteArrayExtra(MmsWapPushReceiver.EXTRA_DATA);
|
||||
mmsReceived(subId, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mmsReceived(final int subId, final byte[] data) {
|
||||
if (!PhoneUtils.getDefault().isSmsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ReceiveMmsMessageAction action = new ReceiveMmsMessageAction(subId, data);
|
||||
action.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,36 +73,12 @@ public final class SmsReceiver extends BroadcastReceiver {
|
||||
* notification.
|
||||
*/
|
||||
public static void updateSmsReceiveHandler(final Context context) {
|
||||
boolean smsReceiverEnabled;
|
||||
boolean mmsWapPushReceiverEnabled;
|
||||
boolean respondViaMessageEnabled;
|
||||
boolean broadcastAbortEnabled;
|
||||
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
// When we're running as the secondary user, we don't get the new SMS_DELIVER intent,
|
||||
// only the primary user receives that. As secondary, we need to go old-school and
|
||||
// listen for the SMS_RECEIVED intent. For the secondary user, use this SmsReceiver
|
||||
// for both sms and mms notification. For the primary user on KLP (and above), we don't
|
||||
// use the SmsReceiver.
|
||||
smsReceiverEnabled = OsUtil.isSecondaryUser();
|
||||
// On KLP use the new deliver event for mms
|
||||
mmsWapPushReceiverEnabled = false;
|
||||
// On KLP we need to always enable this handler to show in the list of sms apps
|
||||
respondViaMessageEnabled = true;
|
||||
// On KLP we don't need to abort the broadcast
|
||||
broadcastAbortEnabled = false;
|
||||
} else {
|
||||
// On JB we use the sms receiver for both sms/mms delivery
|
||||
final boolean carrierSmsEnabled = PhoneUtils.getDefault().isSmsEnabled();
|
||||
smsReceiverEnabled = carrierSmsEnabled;
|
||||
|
||||
// On JB we use the mms receiver when sms/mms is enabled
|
||||
mmsWapPushReceiverEnabled = carrierSmsEnabled;
|
||||
// On JB this is dynamic to make sure we don't show in dialer if sms is disabled
|
||||
respondViaMessageEnabled = carrierSmsEnabled;
|
||||
// On JB we need to abort broadcasts if SMS is enabled
|
||||
broadcastAbortEnabled = carrierSmsEnabled;
|
||||
}
|
||||
// When we're running as the secondary user, we don't get the new SMS_DELIVER intent,
|
||||
// only the primary user receives that. As secondary, we need to go old-school and
|
||||
// listen for the SMS_RECEIVED intent. For the secondary user, use this SmsReceiver
|
||||
// for both sms and mms notification. For the primary user on KLP (and above), we don't
|
||||
// use the SmsReceiver.
|
||||
boolean smsReceiverEnabled = OsUtil.isSecondaryUser();
|
||||
|
||||
final PackageManager packageManager = context.getPackageManager();
|
||||
final boolean logv = LogUtil.isLoggable(TAG, LogUtil.VERBOSE);
|
||||
@@ -122,57 +98,13 @@ public final class SmsReceiver extends BroadcastReceiver {
|
||||
new ComponentName(context, SmsReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
if (mmsWapPushReceiverEnabled) {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Enabling MMS message receiving");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, MmsWapPushReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
} else {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Disabling MMS message receiving");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, MmsWapPushReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
if (broadcastAbortEnabled) {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Enabling SMS/MMS broadcast abort");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, AbortSmsReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, AbortMmsWapPushReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
} else {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Disabling SMS/MMS broadcast abort");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, AbortSmsReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, AbortMmsWapPushReceiver.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
if (respondViaMessageEnabled) {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Enabling respond via message intent");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, NoConfirmationSmsSendService.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
} else {
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Disabling respond via message intent");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, NoConfirmationSmsSendService.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
if (logv) {
|
||||
LogUtil.v(TAG, "Enabling respond via message intent");
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(
|
||||
new ComponentName(context, NoConfirmationSmsSendService.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
|
||||
}
|
||||
|
||||
private static final String EXTRA_ERROR_CODE = "errorCode";
|
||||
@@ -214,9 +146,7 @@ public final class SmsReceiver extends BroadcastReceiver {
|
||||
// seen for the telephony db.
|
||||
messageValues.put(Sms.Inbox.READ, 0);
|
||||
messageValues.put(Sms.Inbox.SEEN, 0);
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
messageValues.put(Sms.SUBSCRIPTION_ID, subId);
|
||||
}
|
||||
messageValues.put(Sms.SUBSCRIPTION_ID, subId);
|
||||
|
||||
if (messages[0].getMessageClass() == android.telephony.SmsMessage.MessageClass.CLASS_0 ||
|
||||
DebugUtils.debugClassZeroSmsEnabled()) {
|
||||
@@ -238,8 +168,6 @@ public final class SmsReceiver extends BroadcastReceiver {
|
||||
// TODO: update this with the actual constant from Telephony
|
||||
"android.provider.Telephony.MMS_DOWNLOADED".equals(action))) {
|
||||
postNewMessageSecondaryUserNotification();
|
||||
} else if (!OsUtil.isAtLeastKLP()) {
|
||||
deliverSmsIntent(context, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.messaging.mmslib.SqliteWrapper;
|
||||
import com.android.messaging.util.BugleGservices;
|
||||
import com.android.messaging.util.BugleGservicesKeys;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.net.URI;
|
||||
@@ -384,7 +383,7 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
|
||||
*/
|
||||
private void loadFromSystem(final int subId, final String apnName, final List<Apn> apns) {
|
||||
Uri uri;
|
||||
if (OsUtil.isAtLeastL_MR1() && subId != MmsManager.DEFAULT_SUB_ID) {
|
||||
if (subId != MmsManager.DEFAULT_SUB_ID) {
|
||||
uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "/subId/" + subId);
|
||||
} else {
|
||||
uri = Telephony.Carriers.CONTENT_URI;
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.util.SparseArray;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
/**
|
||||
@@ -93,12 +92,9 @@ public class BugleCarrierConfigValuesLoader implements CarrierConfigValuesLoader
|
||||
private String loadLocked(final int subId, final Bundle values) {
|
||||
// Load from resources in earlier platform
|
||||
loadFromResources(subId, values);
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
// Load from system to override if system API exists
|
||||
loadFromSystem(subId, values);
|
||||
return "resources+system";
|
||||
}
|
||||
return "resources";
|
||||
// Load from system to override if system API exists
|
||||
loadFromSystem(subId, values);
|
||||
return "resources+system";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,9 +154,6 @@ public class BugleCarrierConfigValuesLoader implements CarrierConfigValuesLoader
|
||||
* @return the sub-dependent Context
|
||||
*/
|
||||
private static Context getSubDepContext(final Context context, final int subId) {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return context;
|
||||
}
|
||||
final int[] mccMnc = PhoneUtils.get(subId).getMccMnc();
|
||||
final int mcc = mccMnc[0];
|
||||
final int mnc = mccMnc[1];
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.text.TextUtils;
|
||||
import com.android.messaging.util.BugleGservices;
|
||||
import com.android.messaging.util.BugleGservicesKeys;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.VersionUtil;
|
||||
|
||||
/**
|
||||
@@ -75,13 +74,11 @@ public class BugleUserAgentInfoLoader implements UserAgentInfoLoader {
|
||||
}
|
||||
|
||||
private void loadLocked() {
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
// load the MMS User agent and UaProfUrl from TelephonyManager APIs
|
||||
final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
mUserAgent = telephonyManager.getMmsUserAgent();
|
||||
mUAProfUrl = telephonyManager.getMmsUAProfUrl();
|
||||
}
|
||||
// load the MMS User agent and UaProfUrl from TelephonyManager APIs
|
||||
final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
mUserAgent = telephonyManager.getMmsUserAgent();
|
||||
mUAProfUrl = telephonyManager.getMmsUAProfUrl();
|
||||
// if user agent string isn't set, use the format "Bugle/<app_version>".
|
||||
if (TextUtils.isEmpty(mUserAgent)) {
|
||||
final String simpleVersionName = VersionUtil.getInstance(mContext).getSimpleName();
|
||||
|
||||
@@ -37,11 +37,9 @@ import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.mmslib.pdu.CharacterSets;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaMetadataRetrieverWrapper;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -120,12 +118,6 @@ public class DatabaseMessages {
|
||||
if (!MmsUtils.hasSmsDateSentColumn()) {
|
||||
projection[INDEX_DATE_SENT] = Sms.DATE;
|
||||
}
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
Assert.equals(INDEX_SUB_ID, projection.length - 1);
|
||||
String[] withoutSubId = new String[projection.length - 1];
|
||||
System.arraycopy(projection, 0, withoutSubId, 0, withoutSubId.length);
|
||||
projection = withoutSubId;
|
||||
}
|
||||
|
||||
sProjection = projection;
|
||||
}
|
||||
@@ -307,13 +299,6 @@ public class DatabaseMessages {
|
||||
Mms.SUBSCRIPTION_ID,
|
||||
};
|
||||
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
Assert.equals(INDEX_SUB_ID, projection.length - 1);
|
||||
String[] withoutSubId = new String[projection.length - 1];
|
||||
System.arraycopy(projection, 0, withoutSubId, 0, withoutSubId.length);
|
||||
projection = withoutSubId;
|
||||
}
|
||||
|
||||
sProjection = projection;
|
||||
}
|
||||
|
||||
@@ -722,11 +707,6 @@ public class DatabaseMessages {
|
||||
* Load video file of a video part and parse the dimensions and type
|
||||
*/
|
||||
private void loadVideo() {
|
||||
// This is a coarse check, and should not be applied to outgoing messages. However,
|
||||
// currently, this does not cause any problems.
|
||||
if (!VideoThumbnailRequest.shouldShowIncomingVideoThumbnails()) {
|
||||
return;
|
||||
}
|
||||
final Uri uri = getDataUri();
|
||||
final MediaMetadataRetrieverWrapper retriever = new MediaMetadataRetrieverWrapper();
|
||||
try {
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -151,27 +150,21 @@ public class MmsConfig {
|
||||
// Rebuild the entire MmsConfig map.
|
||||
sSubIdToMmsConfigMap.clear();
|
||||
loader.reset();
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
final List<SubscriptionInfo> subInfoRecords =
|
||||
PhoneUtils.getDefault().toLMr1().getActiveSubscriptionInfoList();
|
||||
if (subInfoRecords == null) {
|
||||
LogUtil.w(TAG, "Loading mms config failed: no active SIM");
|
||||
return;
|
||||
}
|
||||
for (SubscriptionInfo subInfoRecord : subInfoRecords) {
|
||||
final int subId = subInfoRecord.getSubscriptionId();
|
||||
final Bundle values = loader.get(subId);
|
||||
addMmsConfig(new MmsConfig(subId, values));
|
||||
}
|
||||
} else {
|
||||
final Bundle values = loader.get(ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
addMmsConfig(new MmsConfig(ParticipantData.DEFAULT_SELF_SUB_ID, values));
|
||||
final List<SubscriptionInfo> subInfoRecords =
|
||||
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
|
||||
if (subInfoRecords == null) {
|
||||
LogUtil.w(TAG, "Loading mms config failed: no active SIM");
|
||||
return;
|
||||
}
|
||||
for (SubscriptionInfo subInfoRecord : subInfoRecords) {
|
||||
final int subId = subInfoRecord.getSubscriptionId();
|
||||
final Bundle values = loader.get(subId);
|
||||
addMmsConfig(new MmsConfig(subId, values));
|
||||
}
|
||||
}
|
||||
|
||||
private static void addMmsConfig(MmsConfig mmsConfig) {
|
||||
Assert.isTrue(OsUtil.isAtLeastL_MR1() !=
|
||||
(mmsConfig.mSubId == ParticipantData.DEFAULT_SELF_SUB_ID));
|
||||
Assert.isTrue(mmsConfig.mSubId != ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
sSubIdToMmsConfigMap.put(mmsConfig.mSubId, mmsConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.ImageUtils.ImageResizer;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaMetadataRetrieverWrapper;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
@@ -869,9 +868,7 @@ public class MmsUtils {
|
||||
values.put(Telephony.Sms.SEEN, seen ? 1 : 0);
|
||||
values.put(Telephony.Sms.SUBJECT, subject);
|
||||
values.put(Telephony.Sms.BODY, body);
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
values.put(Telephony.Sms.SUBSCRIPTION_ID, subId);
|
||||
}
|
||||
values.put(Telephony.Sms.SUBSCRIPTION_ID, subId);
|
||||
if (status != Telephony.Sms.STATUS_NONE) {
|
||||
values.put(Telephony.Sms.STATUS, status);
|
||||
}
|
||||
@@ -1156,9 +1153,7 @@ public class MmsUtils {
|
||||
public static SmsMessage getSmsMessageFromDeliveryReport(final Intent intent) {
|
||||
final byte[] pdu = intent.getByteArrayExtra("pdu");
|
||||
final String format = intent.getStringExtra("format");
|
||||
return OsUtil.isAtLeastM()
|
||||
? SmsMessage.createFromPdu(pdu, format)
|
||||
: SmsMessage.createFromPdu(pdu);
|
||||
return SmsMessage.createFromPdu(pdu, format);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1520,27 +1515,22 @@ public class MmsUtils {
|
||||
// For the internal debugger only
|
||||
public static void setUseSystemApnTable(final boolean turnOn) {
|
||||
if (!turnOn) {
|
||||
// We're not turning on to the system table. Instead, we're using our internal table.
|
||||
final int osVersion = OsUtil.getApiVersion();
|
||||
if (osVersion != android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
// We're turning on local APNs on a device where we wouldn't normally have the
|
||||
// local APN table. Build it here.
|
||||
// We're turning on local APNs on a device where we wouldn't normally have the
|
||||
// local APN table. Build it here.
|
||||
final SQLiteDatabase database = ApnDatabase.getApnDatabase().getWritableDatabase();
|
||||
|
||||
final SQLiteDatabase database = ApnDatabase.getApnDatabase().getWritableDatabase();
|
||||
|
||||
// Do we already have the table?
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = database.query(ApnDatabase.APN_TABLE,
|
||||
ApnDatabase.APN_PROJECTION,
|
||||
null, null, null, null, null, null);
|
||||
} catch (final Exception e) {
|
||||
// Apparently there's no table, create it now.
|
||||
ApnDatabase.forceBuildAndLoadApnTables();
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
// Do we already have the table?
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = database.query(ApnDatabase.APN_TABLE,
|
||||
ApnDatabase.APN_PROJECTION,
|
||||
null, null, null, null, null, null);
|
||||
} catch (final Exception e) {
|
||||
// Apparently there's no table, create it now.
|
||||
ApnDatabase.forceBuildAndLoadApnTables();
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1812,14 +1802,6 @@ public class MmsUtils {
|
||||
return new StatusPlusUri(
|
||||
MMS_REQUEST_NO_RETRY, MessageData.RAW_TELEPHONY_STATUS_UNDEFINED, null);
|
||||
}
|
||||
if (!isMmsDataAvailable(subId)) {
|
||||
LogUtil.e(TAG,
|
||||
"MmsUtils: failed to download message, no data available");
|
||||
return new StatusPlusUri(MMS_REQUEST_MANUAL_RETRY,
|
||||
MessageData.RAW_TELEPHONY_STATUS_UNDEFINED,
|
||||
null,
|
||||
SmsManager.MMS_ERROR_NO_DATA_NETWORK);
|
||||
}
|
||||
int status = MMS_REQUEST_MANUAL_RETRY;
|
||||
try {
|
||||
RetrieveConf retrieveConf = null;
|
||||
@@ -1837,14 +1819,10 @@ public class MmsUtils {
|
||||
LogUtil.d(TAG, "MmsUtils: Downloading MMS via MMS lib API; notification "
|
||||
+ "message: " + notificationUri);
|
||||
}
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
if (subId < 0) {
|
||||
LogUtil.e(TAG, "MmsUtils: Incoming MMS came from unknown SIM");
|
||||
throw new MmsFailureException(MMS_REQUEST_NO_RETRY,
|
||||
"Message from unknown SIM");
|
||||
}
|
||||
} else {
|
||||
Assert.isTrue(subId == ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
if (subId < 0) {
|
||||
LogUtil.e(TAG, "MmsUtils: Incoming MMS came from unknown SIM");
|
||||
throw new MmsFailureException(MMS_REQUEST_NO_RETRY,
|
||||
"Message from unknown SIM");
|
||||
}
|
||||
if (extras == null) {
|
||||
extras = new Bundle();
|
||||
@@ -1943,10 +1921,6 @@ public class MmsUtils {
|
||||
LogUtil.w(TAG, "MmsUtils: Can't send NotifyResp; transaction id is null");
|
||||
return;
|
||||
}
|
||||
if (!isMmsDataAvailable(subId)) {
|
||||
LogUtil.w(TAG, "MmsUtils: Can't send NotifyResp; no data available");
|
||||
return;
|
||||
}
|
||||
MmsSender.sendNotifyResponseForMmsDownload(
|
||||
context, subId, transactionId, contentLocation, status);
|
||||
} catch (final MmsFailureException e) {
|
||||
@@ -1973,10 +1947,6 @@ public class MmsUtils {
|
||||
LogUtil.w(TAG, "MmsUtils: Can't send AckInd; transaction id is null");
|
||||
return;
|
||||
}
|
||||
if (!isMmsDataAvailable(subId)) {
|
||||
LogUtil.w(TAG, "MmsUtils: Can't send AckInd; no data available");
|
||||
return;
|
||||
}
|
||||
MmsSender.sendAcknowledgeForMmsDownload(context, subId, transactionId, contentLocation);
|
||||
} catch (final MmsFailureException e) {
|
||||
LogUtil.e(TAG, "sendAcknowledgeForMmsDownload: failed to retrieve message " + e, e);
|
||||
@@ -2021,35 +1991,10 @@ public class MmsUtils {
|
||||
return (RetrieveConf) pdu;
|
||||
}
|
||||
|
||||
private static boolean isMmsDataAvailable(final int subId) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
// L_MR1 above may support sending mms via wifi
|
||||
return true;
|
||||
}
|
||||
final PhoneUtils phoneUtils = PhoneUtils.get(subId);
|
||||
return !phoneUtils.isAirplaneModeOn() && phoneUtils.isMobileDataEnabled();
|
||||
}
|
||||
|
||||
private static boolean isSmsDataAvailable(final int subId) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
// L_MR1 above may support sending sms via wifi
|
||||
return true;
|
||||
}
|
||||
final PhoneUtils phoneUtils = PhoneUtils.get(subId);
|
||||
return !phoneUtils.isAirplaneModeOn();
|
||||
}
|
||||
|
||||
public static StatusPlusUri sendMmsMessage(final Context context, final int subId,
|
||||
final Uri messageUri, final Bundle extras) {
|
||||
int status = MMS_REQUEST_MANUAL_RETRY;
|
||||
int rawStatus = MessageData.RAW_TELEPHONY_STATUS_UNDEFINED;
|
||||
if (!isMmsDataAvailable(subId)) {
|
||||
LogUtil.w(TAG, "MmsUtils: failed to send message, no data available");
|
||||
return new StatusPlusUri(MMS_REQUEST_MANUAL_RETRY,
|
||||
MessageData.RAW_TELEPHONY_STATUS_UNDEFINED,
|
||||
messageUri,
|
||||
SmsManager.MMS_ERROR_NO_DATA_NETWORK);
|
||||
}
|
||||
final PduPersister persister = PduPersister.getPduPersister(context);
|
||||
try {
|
||||
final SendReq sendReq = (SendReq) persister.load(messageUri);
|
||||
@@ -2460,10 +2405,6 @@ public class MmsUtils {
|
||||
public static int sendSmsMessage(final String recipient, final String messageText,
|
||||
final Uri requestUri, final int subId,
|
||||
final String smsServiceCenter, final boolean requireDeliveryReport) {
|
||||
if (!isSmsDataAvailable(subId)) {
|
||||
LogUtil.w(TAG, "MmsUtils: can't send SMS without radio");
|
||||
return MMS_REQUEST_MANUAL_RETRY;
|
||||
}
|
||||
final Context context = Factory.get().getApplicationContext();
|
||||
int status = MMS_REQUEST_MANUAL_RETRY;
|
||||
try {
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.messaging.ui.mediapicker.PausableChronometer;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -79,9 +78,6 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
private int mThemeColor;
|
||||
|
||||
private boolean mStartPlayAfterPrepare;
|
||||
// should the MediaPlayer be prepared lazily when the user chooses to play the audio (as
|
||||
// opposed to preparing it early, on bind)
|
||||
private boolean mPrepareOnPlayback;
|
||||
private boolean mPrepared;
|
||||
private boolean mPlaybackFinished; // Was the audio played all the way to the end
|
||||
private final int mMode;
|
||||
@@ -148,12 +144,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPrepareOnPlayback) {
|
||||
// For lazy preparation, the chronometer will only be shown during playback
|
||||
mChronometer.setVisibility(playing ? View.VISIBLE : View.INVISIBLE);
|
||||
} else {
|
||||
mChronometer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mChronometer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +171,6 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
|
||||
mUseIncomingStyle = useIncomingStyle;
|
||||
mThemeColor = themeColor;
|
||||
mPrepareOnPlayback = incoming && !MediaUtil.canAutoAccessIncomingMedia();
|
||||
|
||||
if (!TextUtils.equals(currentUriString, newUriString)) {
|
||||
mDataSourceUri = dataSourceUri;
|
||||
@@ -216,7 +206,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the MediaPlayer, and if mPrepareOnPlayback, start playing the audio
|
||||
* Prepare the MediaPlayer and start playing the audio
|
||||
*/
|
||||
private void setupMediaPlayer() {
|
||||
Assert.notNull(mDataSourceUri);
|
||||
@@ -332,7 +322,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
updateVisualStyle();
|
||||
updateChronometerVisibility(false /* playing */);
|
||||
|
||||
if (mDataSourceUri != null && !mPrepareOnPlayback) {
|
||||
if (mDataSourceUri != null) {
|
||||
// Prepare the media player, so we can read the duration of the audio.
|
||||
setupMediaPlayer();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -43,8 +40,8 @@ public class LineWrapLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int startPadding = UiUtils.getPaddingStart(this);
|
||||
final int endPadding = UiUtils.getPaddingEnd(this);
|
||||
final int startPadding = getPaddingStart();
|
||||
final int endPadding = getPaddingEnd();
|
||||
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
final int widthSize = MeasureSpec.getSize(widthMeasureSpec) - startPadding - endPadding;
|
||||
final boolean isFixedSize = (widthMode == MeasureSpec.EXACTLY);
|
||||
@@ -96,8 +93,8 @@ public class LineWrapLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
final int startPadding = UiUtils.getPaddingStart(this);
|
||||
final int endPadding = UiUtils.getPaddingEnd(this);
|
||||
final int startPadding = getPaddingStart();
|
||||
final int endPadding = getPaddingEnd();
|
||||
int width = getWidth() - startPadding - endPadding;
|
||||
int y = getPaddingTop();
|
||||
int x = startPadding;
|
||||
@@ -171,7 +168,7 @@ public class LineWrapLayout extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastJB_MR2() && getResources().getConfiguration()
|
||||
if (getResources().getConfiguration()
|
||||
.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
currChild.layout(width - startPositionX - childWidth, startPositionY,
|
||||
width - startPositionX, startPositionY + childHeight);
|
||||
@@ -214,19 +211,11 @@ public class LineWrapLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
public int getStartMargin() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return getMarginStart();
|
||||
} else {
|
||||
return leftMargin;
|
||||
}
|
||||
return getMarginStart();
|
||||
}
|
||||
|
||||
public int getEndMargin() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return getMarginEnd();
|
||||
} else {
|
||||
return rightMargin;
|
||||
}
|
||||
return getMarginEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.android.messaging.ui.SnackBar.SnackBarListener;
|
||||
import com.android.messaging.util.AccessibilityUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.TextUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
@@ -354,22 +353,15 @@ public class SnackBarManager {
|
||||
private int getScreenBottomOffset(final SnackBar snackBar) {
|
||||
final WindowManager windowManager = getWindowManager(snackBar.getContext());
|
||||
final DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||
} else {
|
||||
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||
}
|
||||
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||
|
||||
final int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
// In L, the navigation bar is included in the space for the popup window, so we have to
|
||||
// offset by the size of the navigation bar
|
||||
final Rect displayRect = new Rect();
|
||||
snackBar.getParentView().getRootView().getWindowVisibleDisplayFrame(displayRect);
|
||||
return screenHeight - displayRect.bottom;
|
||||
}
|
||||
|
||||
return 0;
|
||||
// In L, the navigation bar is included in the space for the popup window, so we have to
|
||||
// offset by the size of the navigation bar
|
||||
final Rect displayRect = new Rect();
|
||||
snackBar.getParentView().getRootView().getWindowVisibleDisplayFrame(displayRect);
|
||||
return screenHeight - displayRect.bottom;
|
||||
}
|
||||
|
||||
private int getRelativeOffset(final SnackBar snackBar) {
|
||||
|
||||
@@ -211,30 +211,19 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
mVideoView.start();
|
||||
}
|
||||
|
||||
// TODO: The check could be added to MessagePartData itself so that all users of MessagePartData
|
||||
// get the right behavior, instead of requiring all the users to do similar checks.
|
||||
private static boolean shouldUseGenericVideoIcon(final boolean incomingMessage) {
|
||||
return incomingMessage && !VideoThumbnailRequest.shouldShowIncomingVideoThumbnails();
|
||||
}
|
||||
|
||||
public void setSource(final MessagePartData part, final boolean incomingMessage) {
|
||||
if (part == null) {
|
||||
clearSource();
|
||||
} else {
|
||||
mVideoSource = part.getContentUri();
|
||||
if (shouldUseGenericVideoIcon(incomingMessage)) {
|
||||
mThumbnailImage.setImageResource(R.drawable.generic_video_icon);
|
||||
mVideoWidth = ImageRequest.UNSPECIFIED_SIZE;
|
||||
mVideoHeight = ImageRequest.UNSPECIFIED_SIZE;
|
||||
} else {
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(part));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(mVideoSource);
|
||||
}
|
||||
mVideoWidth = part.getWidth();
|
||||
mVideoHeight = part.getHeight();
|
||||
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(part));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(mVideoSource);
|
||||
}
|
||||
mVideoWidth = part.getWidth();
|
||||
mVideoHeight = part.getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,16 +232,10 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
clearSource();
|
||||
} else {
|
||||
mVideoSource = videoSource;
|
||||
if (shouldUseGenericVideoIcon(incomingMessage)) {
|
||||
mThumbnailImage.setImageResource(R.drawable.generic_video_icon);
|
||||
mVideoWidth = ImageRequest.UNSPECIFIED_SIZE;
|
||||
mVideoHeight = ImageRequest.UNSPECIFIED_SIZE;
|
||||
} else {
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(videoSource));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(videoSource);
|
||||
}
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(videoSource));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(videoSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
public class ViewPagerTabStrip extends LinearLayout {
|
||||
private int mSelectedUnderlineThickness;
|
||||
@@ -97,6 +96,6 @@ public class ViewPagerTabStrip extends LinearLayout {
|
||||
}
|
||||
|
||||
private boolean isRtl() {
|
||||
return OsUtil.isAtLeastJB_MR2() ? getLayoutDirection() == View.LAYOUT_DIRECTION_RTL : false;
|
||||
return getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.widget.Toast;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Lightweight implementation of ViewPager tabs. This looks similar to traditional actionBar tabs,
|
||||
@@ -130,14 +129,12 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
a.recycle();
|
||||
|
||||
// enable shadow casting from view bounds
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(0, 0, view.getWidth(), view.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(0, 0, view.getWidth(), view.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setViewPager(ViewPager viewPager) {
|
||||
@@ -223,7 +220,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
}
|
||||
|
||||
private int getRtlPosition(int position) {
|
||||
if (OsUtil.isAtLeastJB_MR2() && Factory.get().getApplicationContext().getResources()
|
||||
if (Factory.get().getApplicationContext().getResources()
|
||||
.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
return mTabStrip.getChildCount() - 1 - position;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,19 +20,12 @@ import android.animation.RectEvaluator;
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* This evaluator can be used to perform type interpolation between <code>Rect</code> values.
|
||||
* It's backward compatible to Api Level 11.
|
||||
*/
|
||||
public class RectEvaluatorCompat implements TypeEvaluator<Rect> {
|
||||
public static TypeEvaluator<Rect> create() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return new RectEvaluator();
|
||||
} else {
|
||||
return new RectEvaluatorCompat();
|
||||
}
|
||||
return new RectEvaluator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.messaging.ui.animation;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -34,7 +33,6 @@ import android.widget.FrameLayout;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -69,20 +67,15 @@ public class ViewGroupItemVerticalExplodeAnimation {
|
||||
*/
|
||||
public static void startAnimationForView(final ViewGroup container, final View viewToAnimate,
|
||||
final View animationStagingView, final boolean snapshotView, final int duration) {
|
||||
if (OsUtil.isAtLeastJB_MR2() && (viewToAnimate.getContext() instanceof Activity)) {
|
||||
if ((viewToAnimate.getContext() instanceof Activity)) {
|
||||
new ViewExplodeAnimationJellyBeanMR2(viewToAnimate, container, snapshotView, duration)
|
||||
.startAnimation();
|
||||
} else {
|
||||
// Pre JB_MR2, this animation can cause rendering failures which causes the framework
|
||||
// to fall back to software rendering where camera preview isn't supported (b/18264647)
|
||||
// just skip the animation to avoid this case.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation class for API level >= 18.
|
||||
*/
|
||||
@TargetApi(18)
|
||||
private static class ViewExplodeAnimationJellyBeanMR2 {
|
||||
private final View mViewToAnimate;
|
||||
private final ViewGroup mContainer;
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.android.messaging.sms.ApnDatabase;
|
||||
import com.android.messaging.sms.BugleApnSettingsLoader;
|
||||
import com.android.messaging.ui.BugleActionBarActivity;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
@@ -150,13 +149,8 @@ public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
super.onCreate(icicle);
|
||||
|
||||
mDatabase = ApnDatabase.getApnDatabase().getWritableDatabase();
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
} else {
|
||||
mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
}
|
||||
@@ -172,8 +166,7 @@ public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
lv.setEmptyView(empty);
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastL() &&
|
||||
mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
mUnavailable = true;
|
||||
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.android.messaging.ui.LicenseActivity;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.BuglePrefs;
|
||||
import com.android.messaging.util.DebugUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
@@ -151,35 +150,14 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
}
|
||||
|
||||
private void updateSmsEnabledPreferences() {
|
||||
if (!OsUtil.isAtLeastKLP()) {
|
||||
final String defaultSmsAppLabel = getString(R.string.default_sms_app,
|
||||
PhoneUtils.getDefault().getDefaultSmsAppLabel());
|
||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
||||
getPreferenceScreen().removePreference(mSmsDisabledPreference);
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsEnabledPreference.setSummary(defaultSmsAppLabel);
|
||||
} else {
|
||||
final String defaultSmsAppLabel = getString(R.string.default_sms_app,
|
||||
PhoneUtils.getDefault().getDefaultSmsAppLabel());
|
||||
boolean isSmsEnabledBeforeState;
|
||||
boolean isSmsEnabledCurrentState;
|
||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
||||
if (getPreferenceScreen().findPreference(mSmsEnabledPrefKey) == null) {
|
||||
getPreferenceScreen().addPreference(mSmsEnabledPreference);
|
||||
isSmsEnabledBeforeState = false;
|
||||
} else {
|
||||
isSmsEnabledBeforeState = true;
|
||||
}
|
||||
isSmsEnabledCurrentState = true;
|
||||
getPreferenceScreen().removePreference(mSmsDisabledPreference);
|
||||
mSmsEnabledPreference.setSummary(defaultSmsAppLabel);
|
||||
} else {
|
||||
if (getPreferenceScreen().findPreference(mSmsDisabledPrefKey) == null) {
|
||||
getPreferenceScreen().addPreference(mSmsDisabledPreference);
|
||||
isSmsEnabledBeforeState = true;
|
||||
} else {
|
||||
isSmsEnabledBeforeState = false;
|
||||
}
|
||||
isSmsEnabledCurrentState = false;
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsDisabledPreference.setSummary(defaultSmsAppLabel);
|
||||
}
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsDisabledPreference.setSummary(defaultSmsAppLabel);
|
||||
}
|
||||
mIsSmsPreferenceClicked = false;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ import com.android.messaging.util.Assert.RunsOnMainThread;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
import com.android.messaging.util.ImeUtil;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -503,10 +502,6 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
* @param show whether the contact lists are to be shown or hidden.
|
||||
*/
|
||||
private void startExplodeTransitionForContactLists(final boolean show) {
|
||||
if (!OsUtil.isAtLeastL()) {
|
||||
// Explode animation is not supported pre-L.
|
||||
return;
|
||||
}
|
||||
final Explode transition = new Explode();
|
||||
final Rect epicenter = mPendingExplodeView == null ? null :
|
||||
UiUtils.getMeasuredBoundsOnScreen(mPendingExplodeView);
|
||||
@@ -533,10 +528,6 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
* the transition manager for pending explode transition.
|
||||
*/
|
||||
private void toggleContactListItemsVisibilityForPendingTransition(final boolean show) {
|
||||
if (!OsUtil.isAtLeastL()) {
|
||||
// Explode animation is not supported pre-L.
|
||||
return;
|
||||
}
|
||||
mAllContactsListViewHolder.toggleVisibilityForPendingTransition(show, mPendingExplodeView);
|
||||
mFrequentContactsListViewHolder.toggleVisibilityForPendingTransition(show,
|
||||
mPendingExplodeView);
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.messaging.util.BugleGservices;
|
||||
import com.android.messaging.util.BugleGservicesKeys;
|
||||
import com.android.messaging.util.ContactRecipientEntryUtils;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.text.Collator;
|
||||
@@ -129,30 +128,26 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
|
||||
new Cursor[]{personalFilterEmailsCursor, personalFilterPhonesCursor});
|
||||
final CursorResult cursorResult =
|
||||
new CursorResult(personalCursor, false /* sorted */);
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterPhonesCursor = ContactUtil.filterPhonesEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseFilterEmailsCursor = ContactUtil.filterEmailsEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseCursor = new MergeCursor(
|
||||
new Cursor[]{enterpriseFilterEmailsCursor,
|
||||
enterpriseFilterPhonesCursor});
|
||||
cursorResult.enterpriseCursor = enterpriseCursor;
|
||||
}
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterPhonesCursor = ContactUtil.filterPhonesEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseFilterEmailsCursor = ContactUtil.filterEmailsEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseCursor = new MergeCursor(
|
||||
new Cursor[]{enterpriseFilterEmailsCursor,
|
||||
enterpriseFilterPhonesCursor});
|
||||
cursorResult.enterpriseCursor = enterpriseCursor;
|
||||
return cursorResult;
|
||||
} else {
|
||||
final Cursor personalFilterDestinationCursor = ContactUtil
|
||||
.filterDestination(getContext(), searchText).performSynchronousQuery();
|
||||
final CursorResult cursorResult = new CursorResult(personalFilterDestinationCursor,
|
||||
true);
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterDestinationCursor = ContactUtil
|
||||
.filterDestinationEnterprise(getContext(), searchText)
|
||||
.performSynchronousQuery();
|
||||
cursorResult.enterpriseCursor = enterpriseFilterDestinationCursor;
|
||||
}
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterDestinationCursor = ContactUtil
|
||||
.filterDestinationEnterprise(getContext(), searchText)
|
||||
.performSynchronousQuery();
|
||||
cursorResult.enterpriseCursor = enterpriseFilterDestinationCursor;
|
||||
return cursorResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ import com.android.messaging.util.BuglePrefs;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
@@ -867,18 +866,16 @@ public class ComposeMessageView extends LinearLayout
|
||||
|
||||
// Set accessibility traversal order of the components in the send widget.
|
||||
private void setSendWidgetAccessibilityTraversalOrder(final int mode) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
mAttachMediaButton.setAccessibilityTraversalBefore(R.id.compose_message_text);
|
||||
switch (mode) {
|
||||
case SEND_WIDGET_MODE_SIM_SELECTOR:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.self_send_icon);
|
||||
break;
|
||||
case SEND_WIDGET_MODE_SEND_BUTTON:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.send_message_button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mAttachMediaButton.setAccessibilityTraversalBefore(R.id.compose_message_text);
|
||||
switch (mode) {
|
||||
case SEND_WIDGET_MODE_SIM_SELECTOR:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.self_send_icon);
|
||||
break;
|
||||
case SEND_WIDGET_MODE_SEND_BUTTON:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.send_message_button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,8 +976,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
}
|
||||
|
||||
public static boolean shouldShowSimSelector(final ConversationData convData) {
|
||||
return OsUtil.isAtLeastL_MR1() &&
|
||||
convData.getSelfParticipantsCountExcludingDefault(true /* activeOnly */) > 1;
|
||||
return convData.getSelfParticipantsCountExcludingDefault(true /* activeOnly */) > 1;
|
||||
}
|
||||
|
||||
public void sendMessageIgnoreMessageSizeLimit() {
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.messaging.ui.conversationlist.ConversationListActivity;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
public class ConversationActivity extends BugleActionBarActivity
|
||||
@@ -348,11 +347,7 @@ public class ConversationActivity extends BugleActionBarActivity
|
||||
public void onFinishCurrentConversation() {
|
||||
// Simply finish the current activity. The current design is to leave any empty
|
||||
// conversations as is.
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
finishAfterTransition();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
finishAfterTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ConversationMessageData;
|
||||
import com.android.messaging.ui.ConversationDrawables;
|
||||
import com.android.messaging.util.Dates;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Adds a "fast-scroll" bar to the conversation RecyclerView that shows the current position within
|
||||
@@ -63,10 +62,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
* (the feature requires Jellybean MR2 or newer)
|
||||
*/
|
||||
public static ConversationFastScroller addTo(RecyclerView rv, int position) {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return new ConversationFastScroller(rv, position);
|
||||
}
|
||||
return null;
|
||||
return new ConversationFastScroller(rv, position);
|
||||
}
|
||||
|
||||
public static final int POSITION_RIGHT_SIDE = 0;
|
||||
@@ -164,20 +160,12 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
public void refreshConversationThemeColor() {
|
||||
mPreviewTextView.setBackground(
|
||||
ConversationDrawables.get().getFastScrollPreviewDrawable(mPosRight));
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
final StateListDrawable drawable = new StateListDrawable();
|
||||
drawable.addState(new int[]{ android.R.attr.state_pressed },
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(true /* pressed */));
|
||||
drawable.addState(StateSet.WILD_CARD,
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
mThumbImageView.setImageDrawable(drawable);
|
||||
} else {
|
||||
// Android pre-L doesn't seem to handle a StateListDrawable containing a tinted
|
||||
// drawable (it's rendered in the filter base color, which is red), so fall back to
|
||||
// just the regular (non-pressed) drawable.
|
||||
mThumbImageView.setImageDrawable(
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
}
|
||||
final StateListDrawable drawable = new StateListDrawable();
|
||||
drawable.addState(new int[]{ android.R.attr.state_pressed },
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(true /* pressed */));
|
||||
drawable.addState(StateSet.WILD_CARD,
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
mThumbImageView.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1012,7 +1012,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
}
|
||||
|
||||
private FragmentManager getFragmentManagerToUse() {
|
||||
return OsUtil.isAtLeastJB_MR1() ? getChildFragmentManager() : getFragmentManager();
|
||||
return getChildFragmentManager();
|
||||
}
|
||||
|
||||
public MediaPicker getMediaPicker() {
|
||||
@@ -1158,21 +1158,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null);
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
builder.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(final DialogInterface dialog) {
|
||||
mHost.dismissActionMode();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
builder.setOnCancelListener(new OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(final DialogInterface dialog) {
|
||||
mHost.dismissActionMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.setOnDismissListener(dialog -> mHost.dismissActionMode());
|
||||
builder.create().show();
|
||||
} else {
|
||||
warnOfMissingActionConditions(false /*sending*/,
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.android.messaging.datamodel.data.SubscriptionListData.SubscriptionLis
|
||||
import com.android.messaging.ui.conversation.SimSelectorView.SimSelectorViewListener;
|
||||
import com.android.messaging.util.AccessibilityUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.ThreadUtil;
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,6 @@ abstract class ConversationSimSelector extends ConversationInput {
|
||||
mSimSelectorView.bind(subscriptionListData);
|
||||
mDataReady = subscriptionListData != null && subscriptionListData.hasData();
|
||||
if (mPendingShow != null && mDataReady) {
|
||||
Assert.isTrue(OsUtil.isAtLeastL_MR1());
|
||||
final boolean show = mPendingShow.first;
|
||||
final boolean animate = mPendingShow.second;
|
||||
ThreadUtil.getMainThreadHandler().post(new Runnable() {
|
||||
@@ -88,10 +86,6 @@ abstract class ConversationSimSelector extends ConversationInput {
|
||||
}
|
||||
|
||||
private boolean showHide(final boolean show, final boolean animate) {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mDataReady) {
|
||||
mSimSelectorView.showOrHide(show, animate);
|
||||
return mSimSelectorView.isOpen() == show;
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.Dates;
|
||||
import com.android.messaging.util.DebugUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
|
||||
@@ -356,9 +355,7 @@ public class MessageDetailsDialog {
|
||||
|
||||
private static void appendSimInfo(final Resources res,
|
||||
final ParticipantData self, final StringBuilder outString) {
|
||||
if (!OsUtil.isAtLeastL_MR1()
|
||||
|| self == null
|
||||
|| PhoneUtils.getDefault().getActiveSubscriptionCount() < 2) {
|
||||
if (self == null || PhoneUtils.getDefault().getActiveSubscriptionCount() < 2) {
|
||||
return;
|
||||
}
|
||||
// The appended SIM info would look like:
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.view.ViewOutlineProvider;
|
||||
import com.android.messaging.ui.ContactIconView;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.AvatarUriUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Shows SIM avatar icon in the SIM switcher / Self-send button.
|
||||
@@ -34,14 +33,12 @@ import com.android.messaging.util.OsUtil;
|
||||
public class SimIconView extends ContactIconView {
|
||||
public SimIconView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View v, Outline outline) {
|
||||
outline.setOval(0, 0, v.getWidth(), v.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View v, Outline outline) {
|
||||
outline.setOval(0, 0, v.getWidth(), v.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,6 @@ import com.android.messaging.ui.SnackBarInteraction;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.Typefaces;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
@@ -168,9 +167,7 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mListItemReadTypeface = Typefaces.getRobotoNormal();
|
||||
mListItemUnreadTypeface = Typefaces.getRobotoBold();
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setTransitionGroup(true);
|
||||
}
|
||||
setTransitionGroup(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,10 +31,8 @@ import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.sms.MmsConfig;
|
||||
import com.android.messaging.ui.debug.DebugMmsConfigItemView.MmsConfigItemListener;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -79,11 +77,8 @@ public class DebugMmsConfigFragment extends Fragment {
|
||||
}
|
||||
|
||||
public static Integer[] getActiveSubIds() {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return new Integer[] { ParticipantData.DEFAULT_SELF_SUB_ID };
|
||||
}
|
||||
final List<SubscriptionInfo> subRecords =
|
||||
PhoneUtils.getDefault().toLMr1().getActiveSubscriptionInfoList();
|
||||
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
|
||||
if (subRecords == null) {
|
||||
return new Integer[0];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.messaging.datamodel.data.MediaPickerData;
|
||||
import com.android.messaging.datamodel.data.DraftMessageData.DraftMessageSubscriptionDataProvider;
|
||||
import com.android.messaging.ui.BasePagerViewHolder;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
abstract class MediaChooser extends BasePagerViewHolder
|
||||
implements DraftMessageSubscriptionDataProvider {
|
||||
@@ -107,8 +106,7 @@ abstract class MediaChooser extends BasePagerViewHolder
|
||||
}
|
||||
|
||||
protected FragmentManager getFragmentManager() {
|
||||
return OsUtil.isAtLeastJB_MR1() ? mMediaPicker.getChildFragmentManager() :
|
||||
mMediaPicker.getFragmentManager();
|
||||
return mMediaPicker.getChildFragmentManager();
|
||||
}
|
||||
protected LayoutInflater getLayoutInflater() {
|
||||
return LayoutInflater.from(getContext());
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.widget.LinearLayout;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.ui.PagingAwareViewPager;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -202,7 +201,7 @@ public class MediaPickerPanel extends ViewGroup {
|
||||
private int getDesiredHeight() {
|
||||
if (mFullScreen) {
|
||||
int fullHeight = getContext().getResources().getDisplayMetrics().heightPixels;
|
||||
if (OsUtil.isAtLeastKLP() && isAttachedToWindow()) {
|
||||
if (isAttachedToWindow()) {
|
||||
// When we're attached to the window, we can get an accurate height, not necessary
|
||||
// on older API level devices because they don't include the action bar height
|
||||
View composeContainer =
|
||||
|
||||
@@ -73,8 +73,7 @@ public class AccessibilityUtil {
|
||||
}
|
||||
|
||||
// Jelly Bean added support for speaking text verbatim
|
||||
final int eventType = OsUtil.isAtLeastJB() ? AccessibilityEvent.TYPE_ANNOUNCEMENT
|
||||
: AccessibilityEvent.TYPE_VIEW_FOCUSED;
|
||||
final int eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT;
|
||||
|
||||
// Construct an accessibility event with the minimum recommended
|
||||
// attributes. An event without a class name or package may be dropped.
|
||||
@@ -101,11 +100,7 @@ public class AccessibilityUtil {
|
||||
* @return boolean Boolean indicating whether the currently locale is RTL.
|
||||
*/
|
||||
public static boolean isLayoutRtl(final View view) {
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
return View.LAYOUT_DIRECTION_RTL == view.getLayoutDirection();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return View.LAYOUT_DIRECTION_RTL == view.getLayoutDirection();
|
||||
}
|
||||
|
||||
public static String getVocalizedPhoneNumber(final Resources res, final String phoneNumber) {
|
||||
|
||||
@@ -62,10 +62,6 @@ public class BugleActivityUtil {
|
||||
* @return true if the user has SMS permissions, otherwise false.
|
||||
*/
|
||||
private static boolean checkHasSmsPermissionsForUser(Context context, Activity activity) {
|
||||
if (!OsUtil.isAtLeastL()) {
|
||||
// UserManager.DISALLOW_SMS added in L. No multiuser phones before this
|
||||
return true;
|
||||
}
|
||||
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
if (userManager.hasUserRestriction(UserManager.DISALLOW_SMS)) {
|
||||
new AlertDialog.Builder(activity)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,13 +26,6 @@ import com.android.messaging.datamodel.data.ParticipantData;
|
||||
|
||||
/**
|
||||
* ConnectivityUtil listens to the network service state changes.
|
||||
*
|
||||
* On N and beyond, This class instance can be created via ConnectivityUtil(context, subId), use
|
||||
* ConnectivityUtil(context) for others.
|
||||
*
|
||||
* Note that TelephonyManager has createForSubscriptionId() for a specific subId from N but listen()
|
||||
* does not use the subId on the manager, and uses the default subId on PhoneStateListener. From O,
|
||||
* the manager uses its' own subId in listen().
|
||||
*/
|
||||
public class ConnectivityUtil {
|
||||
// Assume not connected until informed differently
|
||||
@@ -45,12 +39,7 @@ public class ConnectivityUtil {
|
||||
public void onPhoneStateChanged(int serviceState);
|
||||
}
|
||||
|
||||
public ConnectivityUtil(final Context context) {
|
||||
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
}
|
||||
|
||||
public ConnectivityUtil(final Context context, final int subId) {
|
||||
Assert.isTrue(OsUtil.isAtLeastN());
|
||||
mTelephonyManager =
|
||||
((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE))
|
||||
.createForSubscriptionId(subId);
|
||||
|
||||
@@ -519,27 +519,21 @@ public class ContactUtil {
|
||||
* Returns if a given contact id belongs to managed profile.
|
||||
*/
|
||||
public static boolean isEnterpriseContactId(final long contactId) {
|
||||
return OsUtil.isAtLeastL() && ContactsContract.Contacts.isEnterpriseContactId(contactId);
|
||||
return ContactsContract.Contacts.isEnterpriseContactId(contactId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Email lookup uri that will query both primary and corp profile
|
||||
*/
|
||||
private static Uri getEmailContentLookupUri() {
|
||||
if (OsUtil.isAtLeastM()) {
|
||||
return Email.ENTERPRISE_CONTENT_LOOKUP_URI;
|
||||
}
|
||||
return Email.CONTENT_LOOKUP_URI;
|
||||
return Email.ENTERPRISE_CONTENT_LOOKUP_URI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns PhoneLookup URI.
|
||||
*/
|
||||
public static Uri getPhoneLookupUri() {
|
||||
if (OsUtil.isAtLeastM()) {
|
||||
return PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI;
|
||||
}
|
||||
return PhoneLookup.CONTENT_FILTER_URI;
|
||||
return PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI;
|
||||
}
|
||||
|
||||
public static boolean hasReadContactsPermission() {
|
||||
|
||||
@@ -302,10 +302,7 @@ public class DebugUtils {
|
||||
final int length = dis.readInt();
|
||||
final byte[] pdu = new byte[length];
|
||||
dis.read(pdu, 0, length);
|
||||
messagesTemp[i] =
|
||||
OsUtil.isAtLeastM()
|
||||
? SmsMessage.createFromPdu(pdu, format)
|
||||
: SmsMessage.createFromPdu(pdu);
|
||||
messagesTemp[i] = SmsMessage.createFromPdu(pdu, format);
|
||||
}
|
||||
messages = messagesTemp;
|
||||
} catch (final FileNotFoundException e) {
|
||||
|
||||
@@ -174,11 +174,7 @@ public class ImageUtils {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setBackgroundDrawableOnView(final View view, final Drawable drawable) {
|
||||
if (OsUtil.isAtLeastJB()) {
|
||||
view.setBackground(drawable);
|
||||
} else {
|
||||
view.setBackgroundDrawable(drawable);
|
||||
}
|
||||
view.setBackground(drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,8 +33,4 @@ public abstract class MediaUtil {
|
||||
*/
|
||||
public abstract void playSound(final Context context, final int resId,
|
||||
final OnCompletionListener completionListener);
|
||||
|
||||
public static boolean canAutoAccessIncomingMedia() {
|
||||
return OsUtil.isAtLeastM();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.app.NotificationChannel;
|
||||
import android.app.NotificationChannelGroup;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
public final class NotificationsUtil {
|
||||
public static final String DEFAULT_CHANNEL_ID = "messaging_channel";
|
||||
@@ -37,10 +36,6 @@ public final class NotificationsUtil {
|
||||
|
||||
public static void createNotificationChannel(Context context, String id,
|
||||
String title, int priority, String groupId) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager = context.getSystemService(NotificationManager.class);
|
||||
NotificationChannel existing = manager.getNotificationChannel(id);
|
||||
if (existing != null) {
|
||||
@@ -56,20 +51,12 @@ public final class NotificationsUtil {
|
||||
}
|
||||
|
||||
public static void deleteNotificationChannel(Context context, String id) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager = context.getSystemService(NotificationManager.class);
|
||||
manager.deleteNotificationChannel(id);
|
||||
}
|
||||
|
||||
public static void createNotificationChannelGroup(Context context, String id,
|
||||
int titleResId) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager = context.getSystemService(NotificationManager.class);
|
||||
NotificationChannelGroup existing = manager.getNotificationChannelGroup(id);
|
||||
if (existing != null) {
|
||||
@@ -82,19 +69,11 @@ public final class NotificationsUtil {
|
||||
}
|
||||
|
||||
public static NotificationChannel getNotificationChannel(Context context, String id) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NotificationManager manager = context.getSystemService(NotificationManager.class);
|
||||
return manager.getNotificationChannel(id);
|
||||
}
|
||||
|
||||
public static NotificationChannelGroup getNotificationChannelGroup(Context context, String id) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NotificationManager manager = context.getSystemService(NotificationManager.class);
|
||||
return manager.getNotificationChannelGroup(id);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@ package com.android.messaging.util;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import androidx.core.os.BuildCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
|
||||
@@ -34,124 +32,20 @@ import java.util.Set;
|
||||
* Android OS version utilities
|
||||
*/
|
||||
public class OsUtil {
|
||||
private static boolean sIsAtLeastICS_MR1;
|
||||
private static boolean sIsAtLeastJB;
|
||||
private static boolean sIsAtLeastJB_MR1;
|
||||
private static boolean sIsAtLeastJB_MR2;
|
||||
private static boolean sIsAtLeastKLP;
|
||||
private static boolean sIsAtLeastL;
|
||||
private static boolean sIsAtLeastL_MR1;
|
||||
private static boolean sIsAtLeastM;
|
||||
private static boolean sIsAtLeastN;
|
||||
|
||||
private static Boolean sIsSecondaryUser = null;
|
||||
|
||||
static {
|
||||
final int v = getApiVersion();
|
||||
sIsAtLeastICS_MR1 = v >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1;
|
||||
sIsAtLeastJB = v >= android.os.Build.VERSION_CODES.JELLY_BEAN;
|
||||
sIsAtLeastJB_MR1 = v >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
|
||||
sIsAtLeastJB_MR2 = v >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
sIsAtLeastKLP = v >= android.os.Build.VERSION_CODES.KITKAT;
|
||||
sIsAtLeastL = v >= android.os.Build.VERSION_CODES.LOLLIPOP;
|
||||
sIsAtLeastL_MR1 = v >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1;
|
||||
sIsAtLeastM = v >= android.os.Build.VERSION_CODES.M;
|
||||
sIsAtLeastN = BuildCompat.isAtLeastN();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least Ice Cream Sandwich
|
||||
* MR1 (API level 15).
|
||||
*/
|
||||
public static boolean isAtLeastICS_MR1() {
|
||||
return sIsAtLeastICS_MR1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least Jelly Bean
|
||||
* (API level 16).
|
||||
*/
|
||||
public static boolean isAtLeastJB() {
|
||||
return sIsAtLeastJB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least Jelly Bean MR1
|
||||
* (API level 17).
|
||||
*/
|
||||
public static boolean isAtLeastJB_MR1() {
|
||||
return sIsAtLeastJB_MR1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least Jelly Bean MR2
|
||||
* (API level 18).
|
||||
*/
|
||||
public static boolean isAtLeastJB_MR2() {
|
||||
return sIsAtLeastJB_MR2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least KLP
|
||||
* (API level 19).
|
||||
*/
|
||||
public static boolean isAtLeastKLP() {
|
||||
return sIsAtLeastKLP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least L
|
||||
* (API level 21).
|
||||
*/
|
||||
public static boolean isAtLeastL() {
|
||||
return sIsAtLeastL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least L MR1
|
||||
* (API level 22).
|
||||
*/
|
||||
public static boolean isAtLeastL_MR1() {
|
||||
return sIsAtLeastL_MR1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least M
|
||||
* (API level 23).
|
||||
*/
|
||||
public static boolean isAtLeastM() {
|
||||
return sIsAtLeastM;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the version of Android that we're running on is at least N
|
||||
* (API level 24).
|
||||
*/
|
||||
public static boolean isAtLeastN() {
|
||||
return sIsAtLeastN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The Android API version of the OS that we're currently running on.
|
||||
*/
|
||||
public static int getApiVersion() {
|
||||
return android.os.Build.VERSION.SDK_INT;
|
||||
}
|
||||
|
||||
public static boolean isSecondaryUser() {
|
||||
if (sIsSecondaryUser == null) {
|
||||
final Context context = Factory.get().getApplicationContext();
|
||||
boolean isSecondaryUser = false;
|
||||
|
||||
// Only check for newer devices (but not the nexus 10)
|
||||
if (OsUtil.sIsAtLeastJB_MR1 && !"Nexus 10".equals(Build.MODEL)) {
|
||||
final UserHandle uh = android.os.Process.myUserHandle();
|
||||
final UserManager userManager =
|
||||
(UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
if (userManager != null) {
|
||||
final long userSerialNumber = userManager.getSerialNumberForUser(uh);
|
||||
isSecondaryUser = (0 != userSerialNumber);
|
||||
}
|
||||
final UserHandle uh = android.os.Process.myUserHandle();
|
||||
final UserManager userManager =
|
||||
(UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
if (userManager != null) {
|
||||
final long userSerialNumber = userManager.getSerialNumberForUser(uh);
|
||||
isSecondaryUser = (0 != userSerialNumber);
|
||||
}
|
||||
sIsSecondaryUser = isSecondaryUser;
|
||||
}
|
||||
@@ -192,20 +86,16 @@ public class OsUtil {
|
||||
* @param permission A permission from {@link android.Manifest.permission}
|
||||
*/
|
||||
public static boolean hasPermission(final String permission) {
|
||||
if (OsUtil.isAtLeastM()) {
|
||||
// It is safe to cache the PERMISSION_GRANTED result as the process gets killed if the
|
||||
// user revokes the permission setting. However, PERMISSION_DENIED should not be
|
||||
// cached as the process does not get killed if the user enables the permission setting.
|
||||
if (!sPermissions.containsKey(permission)
|
||||
|| sPermissions.get(permission) == PackageManager.PERMISSION_DENIED) {
|
||||
final Context context = Factory.get().getApplicationContext();
|
||||
final int permissionState = context.checkSelfPermission(permission);
|
||||
sPermissions.put(permission, permissionState);
|
||||
}
|
||||
return sPermissions.get(permission) == PackageManager.PERMISSION_GRANTED;
|
||||
} else {
|
||||
return true;
|
||||
// It is safe to cache the PERMISSION_GRANTED result as the process gets killed if the
|
||||
// user revokes the permission setting. However, PERMISSION_DENIED should not be
|
||||
// cached as the process does not get killed if the user enables the permission setting.
|
||||
if (!sPermissions.containsKey(permission)
|
||||
|| sPermissions.get(permission) == PackageManager.PERMISSION_DENIED) {
|
||||
final Context context = Factory.get().getApplicationContext();
|
||||
final int permissionState = context.checkSelfPermission(permission);
|
||||
sPermissions.put(permission, permissionState);
|
||||
}
|
||||
return sPermissions.get(permission) == PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
/** Does the app have all the specified permissions */
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
package com.android.messaging.util;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.ApplicationInfoFlags;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.database.Cursor;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Telephony;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
@@ -35,7 +34,6 @@ import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.core.os.BuildCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
@@ -64,7 +62,7 @@ import java.util.Locale;
|
||||
*
|
||||
* A convenient getDefault() method is provided for default subId (-1) on any platform
|
||||
*/
|
||||
public abstract class PhoneUtils {
|
||||
public class PhoneUtils {
|
||||
private static final String TAG = LogUtil.BUGLE_TAG;
|
||||
|
||||
private static final int MINIMUM_PHONE_NUMBER_LENGTH_TO_FORMAT = 6;
|
||||
@@ -79,6 +77,7 @@ public abstract class PhoneUtils {
|
||||
|
||||
protected final Context mContext;
|
||||
protected final TelephonyManager mTelephonyManager;
|
||||
private final SubscriptionManager mSubscriptionManager;
|
||||
protected final int mSubId;
|
||||
|
||||
public PhoneUtils(int subId) {
|
||||
@@ -86,6 +85,7 @@ public abstract class PhoneUtils {
|
||||
mContext = Factory.get().getApplicationContext();
|
||||
mTelephonyManager =
|
||||
(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
mSubscriptionManager = SubscriptionManager.from(Factory.get().getApplicationContext());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,49 +93,90 @@ public abstract class PhoneUtils {
|
||||
*
|
||||
* @return the country code on the SIM
|
||||
*/
|
||||
public abstract String getSimCountry();
|
||||
public String getSimCountry() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
final String country = subInfo.getCountryIso();
|
||||
if (TextUtils.isEmpty(country)) {
|
||||
return null;
|
||||
}
|
||||
return country.toUpperCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of SIM slots
|
||||
*
|
||||
* @return the SIM slot count
|
||||
*/
|
||||
public abstract int getSimSlotCount();
|
||||
public int getSimSlotCount() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCountMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SIM's carrier name
|
||||
*
|
||||
* @return the carrier name of the SIM
|
||||
*/
|
||||
public abstract String getCarrierName();
|
||||
public String getCarrierName() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
final CharSequence displayName = subInfo.getDisplayName();
|
||||
if (!TextUtils.isEmpty(displayName)) {
|
||||
return displayName.toString();
|
||||
}
|
||||
final CharSequence carrierName = subInfo.getCarrierName();
|
||||
if (carrierName != null) {
|
||||
return carrierName.toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is SIM inserted on the device
|
||||
*
|
||||
* @return true if there is SIM inserted, false otherwise
|
||||
*/
|
||||
public abstract boolean hasSim();
|
||||
public boolean hasSim() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the SIM is roaming
|
||||
*
|
||||
* @return true if the SIM is in romaing state, false otherwise
|
||||
*/
|
||||
public abstract boolean isRoaming();
|
||||
public boolean isRoaming() {
|
||||
return mSubscriptionManager.isNetworkRoaming(mSubId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MCC and MNC in integer of the SIM's provider
|
||||
*
|
||||
* @return an array of two ints, [0] is the MCC code and [1] is the MNC code
|
||||
*/
|
||||
public abstract int[] getMccMnc();
|
||||
public int[] getMccMnc() {
|
||||
int mcc = 0;
|
||||
int mnc = 0;
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
mcc = subInfo.getMcc();
|
||||
mnc = subInfo.getMnc();
|
||||
}
|
||||
return new int[]{mcc, mnc};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mcc/mnc string
|
||||
*
|
||||
* @return the text of mccmnc string
|
||||
*/
|
||||
public abstract String getSimOperatorNumeric();
|
||||
public String getSimOperatorNumeric() {
|
||||
// For L_MR1 we return the canonicalized (xxxxxx) string
|
||||
return getMccMncString(getMccMnc());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SIM's self raw number, i.e. not canonicalized
|
||||
@@ -144,7 +185,25 @@ public abstract class PhoneUtils {
|
||||
* @return the original self number
|
||||
* @throws IllegalStateException if no active subscription on L-MR1+
|
||||
*/
|
||||
public abstract String getSelfRawNumber(final boolean allowOverride);
|
||||
public String getSelfRawNumber(final boolean allowOverride) {
|
||||
if (allowOverride) {
|
||||
final String userDefinedNumber = getNumberFromPrefs(mContext, mSubId);
|
||||
if (!TextUtils.isEmpty(userDefinedNumber)) {
|
||||
return userDefinedNumber;
|
||||
}
|
||||
}
|
||||
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
String phoneNumber = subInfo.getNumber();
|
||||
if (TextUtils.isEmpty(phoneNumber) && LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
|
||||
LogUtil.d(TAG, "SubscriptionInfo phone number for self is empty!");
|
||||
}
|
||||
return phoneNumber;
|
||||
}
|
||||
LogUtil.w(TAG, "PhoneUtils.getSelfRawNumber: subInfo is null for " + mSubId);
|
||||
throw new IllegalStateException("No active subscription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "effective" subId, or the subId used in the context of actual messages,
|
||||
@@ -159,31 +218,49 @@ public abstract class PhoneUtils {
|
||||
* @param subId The input subId
|
||||
* @return the real subId if we can convert
|
||||
*/
|
||||
public abstract int getEffectiveSubId(int subId);
|
||||
public int getEffectiveSubId(int subId) {
|
||||
if (subId == ParticipantData.DEFAULT_SELF_SUB_ID) {
|
||||
return getDefaultSmsSubscriptionId();
|
||||
}
|
||||
return subId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of active subscriptions in the device.
|
||||
*/
|
||||
public abstract int getActiveSubscriptionCount();
|
||||
public int getActiveSubscriptionCount() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get {@link SmsManager} instance
|
||||
*
|
||||
* @return the relevant SmsManager instance based on OS version and subId
|
||||
*/
|
||||
public abstract SmsManager getSmsManager();
|
||||
public SmsManager getSmsManager() {
|
||||
return SmsManager.getSmsManagerForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default SMS subscription id
|
||||
*
|
||||
* @return the default sub ID
|
||||
*/
|
||||
public abstract int getDefaultSmsSubscriptionId();
|
||||
public int getDefaultSmsSubscriptionId() {
|
||||
final int systemDefaultSubId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
if (systemDefaultSubId < 0) {
|
||||
// Always use -1 for any negative subId from system
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
return systemDefaultSubId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if there's currently a system default SIM selected for sending SMS.
|
||||
*/
|
||||
public abstract boolean getHasPreferredSmsSim();
|
||||
public boolean getHasPreferredSmsSim() {
|
||||
return getDefaultSmsSubscriptionId() != ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* For L_MR1, system may return a negative subId. Convert this into our own
|
||||
@@ -195,7 +272,23 @@ public abstract class PhoneUtils {
|
||||
* @param extraName The name of the sub id extra
|
||||
* @return the subId that is valid and meaningful for the app
|
||||
*/
|
||||
public abstract int getEffectiveIncomingSubIdFromSystem(Intent intent, String extraName);
|
||||
public int getEffectiveIncomingSubIdFromSystem(Intent intent, String extraName) {
|
||||
return getEffectiveIncomingSubIdFromSystem(intent.getIntExtra(extraName,
|
||||
ParticipantData.DEFAULT_SELF_SUB_ID));
|
||||
}
|
||||
|
||||
private int getEffectiveIncomingSubIdFromSystem(int subId) {
|
||||
if (subId < 0) {
|
||||
if (mSubscriptionManager.getActiveSubscriptionInfoCount() > 1) {
|
||||
// For multi-SIM device, we can not decide which SIM to use if system
|
||||
// does not know either. So just make it the invalid sub id.
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
// For single-SIM device, it must come from the only SIM we have
|
||||
return getDefaultSmsSubscriptionId();
|
||||
}
|
||||
return subId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription_id column value from a telephony provider cursor
|
||||
@@ -204,438 +297,107 @@ public abstract class PhoneUtils {
|
||||
* @param subIdIndex The index of the subId column in the cursor
|
||||
* @return the subscription_id column value from the cursor
|
||||
*/
|
||||
public abstract int getSubIdFromTelephony(Cursor cursor, int subIdIndex);
|
||||
public int getSubIdFromTelephony(Cursor cursor, int subIdIndex) {
|
||||
return getEffectiveIncomingSubIdFromSystem(cursor.getInt(subIdIndex));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if data roaming is enabled
|
||||
*
|
||||
* @return true if data roaming is enabled, false otherwise
|
||||
*/
|
||||
public abstract boolean isDataRoamingEnabled();
|
||||
public boolean isDataRoamingEnabled() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo == null) {
|
||||
// There is nothing we can do if system give us empty sub info
|
||||
LogUtil.e(TAG, "PhoneUtils.isDataRoamingEnabled: system return empty sub info for "
|
||||
+ mSubId);
|
||||
return false;
|
||||
}
|
||||
return subInfo.getDataRoaming() != SubscriptionManager.DATA_ROAMING_DISABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mobile data is enabled
|
||||
*
|
||||
* @return true if mobile data is enabled, false otherwise
|
||||
*/
|
||||
public abstract boolean isMobileDataEnabled();
|
||||
public boolean isMobileDataEnabled() {
|
||||
boolean mobileDataEnabled = false;
|
||||
try {
|
||||
final Class cmClass = mTelephonyManager.getClass();
|
||||
final Method method = cmClass.getDeclaredMethod("getDataEnabled", Integer.TYPE);
|
||||
method.setAccessible(true); // Make the method callable
|
||||
// get the setting for "mobile data"
|
||||
mobileDataEnabled = (Boolean) method.invoke(
|
||||
mTelephonyManager, Integer.valueOf(mSubId));
|
||||
} catch (final Exception e) {
|
||||
LogUtil.e(TAG, "PhoneUtil.isMobileDataEnabled: system api not found", e);
|
||||
}
|
||||
return mobileDataEnabled;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of self phone numbers, all normalized
|
||||
*
|
||||
* @return the set of normalized self phone numbers
|
||||
*/
|
||||
public abstract HashSet<String> getNormalizedSelfNumbers();
|
||||
|
||||
/**
|
||||
* This interface packages methods should only compile on L_MR1.
|
||||
* This is needed to make unit tests happy when mockito tries to
|
||||
* mock these methods. Calling on these methods on L_MR1 requires
|
||||
* an extra invocation of toMr1().
|
||||
*/
|
||||
public interface LMr1 {
|
||||
/**
|
||||
* Get this SIM's information. Only applies to L_MR1 above
|
||||
*
|
||||
* @return the subscription info of the SIM
|
||||
*/
|
||||
public abstract SubscriptionInfo getActiveSubscriptionInfo();
|
||||
|
||||
/**
|
||||
* Get the list of active SIMs in system. Only applies to L_MR1 above
|
||||
*
|
||||
* @return the list of subscription info for all inserted SIMs
|
||||
*/
|
||||
public abstract List<SubscriptionInfo> getActiveSubscriptionInfoList();
|
||||
|
||||
/**
|
||||
* Register subscription change listener. Only applies to L_MR1 above
|
||||
*
|
||||
* @param listener The listener to register
|
||||
*/
|
||||
public abstract void registerOnSubscriptionsChangedListener(
|
||||
SubscriptionManager.OnSubscriptionsChangedListener listener);
|
||||
public HashSet<String> getNormalizedSelfNumbers() {
|
||||
final HashSet<String> numbers = new HashSet<>();
|
||||
for (SubscriptionInfo info : getActiveSubscriptionInfoList()) {
|
||||
numbers.add(PhoneUtils.get(info.getSubscriptionId()).getCanonicalForSelf(
|
||||
true/*allowOverride*/));
|
||||
}
|
||||
return numbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* The PhoneUtils class for pre L_MR1
|
||||
* Get this SIM's information. Only applies to L_MR1 above
|
||||
*
|
||||
* @return the subscription info of the SIM
|
||||
*/
|
||||
public static class PhoneUtilsPreLMR1 extends PhoneUtils {
|
||||
private final ConnectivityManager mConnectivityManager;
|
||||
|
||||
public PhoneUtilsPreLMR1() {
|
||||
super(ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
mConnectivityManager =
|
||||
(ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSimCountry() {
|
||||
final String country = mTelephonyManager.getSimCountryIso();
|
||||
if (TextUtils.isEmpty(country)) {
|
||||
return null;
|
||||
}
|
||||
return country.toUpperCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSimSlotCount() {
|
||||
// Don't support MSIM pre-L_MR1
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCarrierName() {
|
||||
return mTelephonyManager.getNetworkOperatorName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSim() {
|
||||
return mTelephonyManager.getSimState() != TelephonyManager.SIM_STATE_ABSENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoaming() {
|
||||
return mTelephonyManager.isNetworkRoaming();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getMccMnc() {
|
||||
final String mccmnc = mTelephonyManager.getSimOperator();
|
||||
int mcc = 0;
|
||||
int mnc = 0;
|
||||
try {
|
||||
mcc = Integer.parseInt(mccmnc.substring(0, 3));
|
||||
mnc = Integer.parseInt(mccmnc.substring(3));
|
||||
} catch (Exception e) {
|
||||
LogUtil.w(TAG, "PhoneUtils.getMccMnc: invalid string " + mccmnc, e);
|
||||
}
|
||||
return new int[]{mcc, mnc};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSimOperatorNumeric() {
|
||||
return mTelephonyManager.getSimOperator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelfRawNumber(final boolean allowOverride) {
|
||||
if (allowOverride) {
|
||||
final String userDefinedNumber = getNumberFromPrefs(mContext,
|
||||
ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
if (!TextUtils.isEmpty(userDefinedNumber)) {
|
||||
return userDefinedNumber;
|
||||
}
|
||||
}
|
||||
return mTelephonyManager.getLine1Number();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveSubId(int subId) {
|
||||
Assert.equals(ParticipantData.DEFAULT_SELF_SUB_ID, subId);
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsManager getSmsManager() {
|
||||
return SmsManager.getDefault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSmsSubscriptionId() {
|
||||
Assert.fail("PhoneUtils.getDefaultSmsSubscriptionId(): not supported before L MR1");
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasPreferredSmsSim() {
|
||||
// SIM selection is not supported pre-L_MR1.
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveSubscriptionCount() {
|
||||
return hasSim() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveIncomingSubIdFromSystem(Intent intent, String extraName) {
|
||||
// Pre-L_MR1 always returns the default id
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubIdFromTelephony(Cursor cursor, int subIdIndex) {
|
||||
// No subscription_id column before L_MR1
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isDataRoamingEnabled() {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
return mTelephonyManager.isDataRoamingEnabled();
|
||||
}
|
||||
boolean dataRoamingEnabled = false;
|
||||
final ContentResolver cr = mContext.getContentResolver();
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
dataRoamingEnabled =
|
||||
(Settings.Global.getInt(cr, Settings.Global.DATA_ROAMING, 0) != 0);
|
||||
} else {
|
||||
dataRoamingEnabled =
|
||||
(Settings.System.getInt(cr, Settings.System.DATA_ROAMING, 0) != 0);
|
||||
}
|
||||
return dataRoamingEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMobileDataEnabled() {
|
||||
boolean mobileDataEnabled = false;
|
||||
try {
|
||||
final Class cmClass = mConnectivityManager.getClass();
|
||||
final Method method = cmClass.getDeclaredMethod("getMobileDataEnabled");
|
||||
method.setAccessible(true); // Make the method callable
|
||||
// get the setting for "mobile data"
|
||||
mobileDataEnabled = (Boolean) method.invoke(mConnectivityManager);
|
||||
} catch (final Exception e) {
|
||||
LogUtil.e(TAG, "PhoneUtil.isMobileDataEnabled: system api not found", e);
|
||||
}
|
||||
return mobileDataEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<String> getNormalizedSelfNumbers() {
|
||||
final HashSet<String> numbers = new HashSet<>();
|
||||
numbers.add(getCanonicalForSelf(true/*allowOverride*/));
|
||||
return numbers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The PhoneUtils class for L_MR1
|
||||
*/
|
||||
public static class PhoneUtilsLMR1 extends PhoneUtils implements LMr1 {
|
||||
private final SubscriptionManager mSubscriptionManager;
|
||||
|
||||
public PhoneUtilsLMR1(final int subId) {
|
||||
super(subId);
|
||||
mSubscriptionManager = SubscriptionManager.from(Factory.get().getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSimCountry() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
final String country = subInfo.getCountryIso();
|
||||
if (TextUtils.isEmpty(country)) {
|
||||
return null;
|
||||
}
|
||||
return country.toUpperCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSimSlotCount() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCountMax();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCarrierName() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
final CharSequence displayName = subInfo.getDisplayName();
|
||||
if (!TextUtils.isEmpty(displayName)) {
|
||||
return displayName.toString();
|
||||
}
|
||||
final CharSequence carrierName = subInfo.getCarrierName();
|
||||
if (carrierName != null) {
|
||||
return carrierName.toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSim() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoaming() {
|
||||
return mSubscriptionManager.isNetworkRoaming(mSubId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getMccMnc() {
|
||||
int mcc = 0;
|
||||
int mnc = 0;
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
mcc = subInfo.getMcc();
|
||||
mnc = subInfo.getMnc();
|
||||
}
|
||||
return new int[]{mcc, mnc};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSimOperatorNumeric() {
|
||||
// For L_MR1 we return the canonicalized (xxxxxx) string
|
||||
return getMccMncString(getMccMnc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelfRawNumber(final boolean allowOverride) {
|
||||
if (allowOverride) {
|
||||
final String userDefinedNumber = getNumberFromPrefs(mContext, mSubId);
|
||||
if (!TextUtils.isEmpty(userDefinedNumber)) {
|
||||
return userDefinedNumber;
|
||||
}
|
||||
}
|
||||
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
if (subInfo != null) {
|
||||
String phoneNumber = subInfo.getNumber();
|
||||
if (TextUtils.isEmpty(phoneNumber) && LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
|
||||
LogUtil.d(TAG, "SubscriptionInfo phone number for self is empty!");
|
||||
}
|
||||
return phoneNumber;
|
||||
}
|
||||
LogUtil.w(TAG, "PhoneUtils.getSelfRawNumber: subInfo is null for " + mSubId);
|
||||
throw new IllegalStateException("No active subscription");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscriptionInfo getActiveSubscriptionInfo() {
|
||||
try {
|
||||
final SubscriptionInfo subInfo =
|
||||
mSubscriptionManager.getActiveSubscriptionInfo(mSubId);
|
||||
if (subInfo == null) {
|
||||
if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
|
||||
// This is possible if the sub id is no longer available.
|
||||
LogUtil.d(TAG, "PhoneUtils.getActiveSubscriptionInfo(): empty sub info for "
|
||||
+ mSubId);
|
||||
}
|
||||
}
|
||||
return subInfo;
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "PhoneUtils.getActiveSubscriptionInfo: system exception for "
|
||||
+ mSubId, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
|
||||
final List<SubscriptionInfo> subscriptionInfos =
|
||||
mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subscriptionInfos != null) {
|
||||
return subscriptionInfos;
|
||||
}
|
||||
return EMPTY_SUBSCRIPTION_LIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveSubId(int subId) {
|
||||
if (subId == ParticipantData.DEFAULT_SELF_SUB_ID) {
|
||||
return getDefaultSmsSubscriptionId();
|
||||
}
|
||||
return subId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnSubscriptionsChangedListener(
|
||||
SubscriptionManager.OnSubscriptionsChangedListener listener) {
|
||||
mSubscriptionManager.addOnSubscriptionsChangedListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsManager getSmsManager() {
|
||||
return SmsManager.getSmsManagerForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultSmsSubscriptionId() {
|
||||
final int systemDefaultSubId = SmsManager.getDefaultSmsSubscriptionId();
|
||||
if (systemDefaultSubId < 0) {
|
||||
// Always use -1 for any negative subId from system
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
return systemDefaultSubId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasPreferredSmsSim() {
|
||||
return getDefaultSmsSubscriptionId() != ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveSubscriptionCount() {
|
||||
return mSubscriptionManager.getActiveSubscriptionInfoCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveIncomingSubIdFromSystem(Intent intent, String extraName) {
|
||||
return getEffectiveIncomingSubIdFromSystem(intent.getIntExtra(extraName,
|
||||
ParticipantData.DEFAULT_SELF_SUB_ID));
|
||||
}
|
||||
|
||||
private int getEffectiveIncomingSubIdFromSystem(int subId) {
|
||||
if (subId < 0) {
|
||||
if (mSubscriptionManager.getActiveSubscriptionInfoCount() > 1) {
|
||||
// For multi-SIM device, we can not decide which SIM to use if system
|
||||
// does not know either. So just make it the invalid sub id.
|
||||
return ParticipantData.DEFAULT_SELF_SUB_ID;
|
||||
}
|
||||
// For single-SIM device, it must come from the only SIM we have
|
||||
return getDefaultSmsSubscriptionId();
|
||||
}
|
||||
return subId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubIdFromTelephony(Cursor cursor, int subIdIndex) {
|
||||
return getEffectiveIncomingSubIdFromSystem(cursor.getInt(subIdIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataRoamingEnabled() {
|
||||
final SubscriptionInfo subInfo = getActiveSubscriptionInfo();
|
||||
public SubscriptionInfo getActiveSubscriptionInfo() {
|
||||
try {
|
||||
final SubscriptionInfo subInfo =
|
||||
mSubscriptionManager.getActiveSubscriptionInfo(mSubId);
|
||||
if (subInfo == null) {
|
||||
// There is nothing we can do if system give us empty sub info
|
||||
LogUtil.e(TAG, "PhoneUtils.isDataRoamingEnabled: system return empty sub info for "
|
||||
+ mSubId);
|
||||
return false;
|
||||
if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
|
||||
// This is possible if the sub id is no longer available.
|
||||
LogUtil.d(TAG, "PhoneUtils.getActiveSubscriptionInfo(): empty sub info for "
|
||||
+ mSubId);
|
||||
}
|
||||
}
|
||||
return subInfo.getDataRoaming() != SubscriptionManager.DATA_ROAMING_DISABLE;
|
||||
return subInfo;
|
||||
} catch (Exception e) {
|
||||
LogUtil.e(TAG, "PhoneUtils.getActiveSubscriptionInfo: system exception for "
|
||||
+ mSubId, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMobileDataEnabled() {
|
||||
boolean mobileDataEnabled = false;
|
||||
try {
|
||||
final Class cmClass = mTelephonyManager.getClass();
|
||||
final Method method = cmClass.getDeclaredMethod("getDataEnabled", Integer.TYPE);
|
||||
method.setAccessible(true); // Make the method callable
|
||||
// get the setting for "mobile data"
|
||||
mobileDataEnabled = (Boolean) method.invoke(
|
||||
mTelephonyManager, Integer.valueOf(mSubId));
|
||||
} catch (final Exception e) {
|
||||
LogUtil.e(TAG, "PhoneUtil.isMobileDataEnabled: system api not found", e);
|
||||
}
|
||||
return mobileDataEnabled;
|
||||
|
||||
/**
|
||||
* Get the list of active SIMs in system. Only applies to L_MR1 above
|
||||
*
|
||||
* @return the list of subscription info for all inserted SIMs
|
||||
*/
|
||||
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
|
||||
final List<SubscriptionInfo> subscriptionInfos =
|
||||
mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subscriptionInfos != null) {
|
||||
return subscriptionInfos;
|
||||
}
|
||||
return EMPTY_SUBSCRIPTION_LIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<String> getNormalizedSelfNumbers() {
|
||||
final HashSet<String> numbers = new HashSet<>();
|
||||
for (SubscriptionInfo info : getActiveSubscriptionInfoList()) {
|
||||
numbers.add(PhoneUtils.get(info.getSubscriptionId()).getCanonicalForSelf(
|
||||
true/*allowOverride*/));
|
||||
}
|
||||
return numbers;
|
||||
}
|
||||
/**
|
||||
* Register subscription change listener. Only applies to L_MR1 above
|
||||
*
|
||||
* @param listener The listener to register
|
||||
*/
|
||||
public void registerOnSubscriptionsChangedListener(
|
||||
SubscriptionManager.OnSubscriptionsChangedListener listener) {
|
||||
mSubscriptionManager.addOnSubscriptionsChangedListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,15 +421,6 @@ public abstract class PhoneUtils {
|
||||
return Factory.get().getPhoneUtils(subId);
|
||||
}
|
||||
|
||||
public LMr1 toLMr1() {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
return (LMr1) this;
|
||||
} else {
|
||||
Assert.fail("PhoneUtils.toLMr1(): invalid OS version");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this device supports SMS
|
||||
*
|
||||
@@ -897,12 +650,9 @@ public abstract class PhoneUtils {
|
||||
* - On JB (and below) this always returns true, since the setting was added in KLP.
|
||||
*/
|
||||
public boolean isDefaultSmsApp() {
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
RoleManager roleManager = mContext.getSystemService(RoleManager.class);
|
||||
return roleManager.isRoleAvailable(RoleManager.ROLE_SMS)
|
||||
&& roleManager.isRoleHeld(RoleManager.ROLE_SMS);
|
||||
}
|
||||
return true;
|
||||
RoleManager roleManager = mContext.getSystemService(RoleManager.class);
|
||||
return roleManager.isRoleAvailable(RoleManager.ROLE_SMS)
|
||||
&& roleManager.isRoleHeld(RoleManager.ROLE_SMS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,10 +661,7 @@ public abstract class PhoneUtils {
|
||||
* @return the package name of default SMS app
|
||||
*/
|
||||
public String getDefaultSmsApp() {
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
return Telephony.Sms.getDefaultSmsPackage(mContext);
|
||||
}
|
||||
return null;
|
||||
return Telephony.Sms.getDefaultSmsPackage(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -931,15 +678,14 @@ public abstract class PhoneUtils {
|
||||
* an error or there is no default app (e.g. JB and below).
|
||||
*/
|
||||
public String getDefaultSmsAppLabel() {
|
||||
if (OsUtil.isAtLeastKLP()) {
|
||||
final String packageName = Telephony.Sms.getDefaultSmsPackage(mContext);
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
final ApplicationInfo appInfo = pm.getApplicationInfo(packageName, 0);
|
||||
return pm.getApplicationLabel(appInfo).toString();
|
||||
} catch (NameNotFoundException e) {
|
||||
// Fall through and return empty string
|
||||
}
|
||||
final String packageName = Telephony.Sms.getDefaultSmsPackage(mContext);
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
final ApplicationInfo appInfo = pm.getApplicationInfo(packageName,
|
||||
ApplicationInfoFlags.of(0));
|
||||
return pm.getApplicationLabel(appInfo).toString();
|
||||
} catch (NameNotFoundException e) {
|
||||
// Fall through and return empty string
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -949,15 +695,9 @@ public abstract class PhoneUtils {
|
||||
*
|
||||
* @return true if enabled.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isAirplaneModeOn() {
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
|
||||
} else {
|
||||
return Settings.System.getInt(mContext.getContentResolver(),
|
||||
Settings.System.AIRPLANE_MODE_ON, 0) != 0;
|
||||
}
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
|
||||
}
|
||||
|
||||
public static String getMccMncString(int[] mccmnc) {
|
||||
@@ -995,14 +735,10 @@ public abstract class PhoneUtils {
|
||||
* @param runnable a {@link SubscriptionRunnable} for performing work on each subscription.
|
||||
*/
|
||||
public static void forEachActiveSubscription(final SubscriptionRunnable runnable) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
final List<SubscriptionInfo> subscriptionList =
|
||||
getDefault().toLMr1().getActiveSubscriptionInfoList();
|
||||
for (final SubscriptionInfo subscriptionInfo : subscriptionList) {
|
||||
runnable.runForSubscription(subscriptionInfo.getSubscriptionId());
|
||||
}
|
||||
} else {
|
||||
runnable.runForSubscription(ParticipantData.DEFAULT_SELF_SUB_ID);
|
||||
final List<SubscriptionInfo> subscriptionList =
|
||||
getDefault().getActiveSubscriptionInfoList();
|
||||
for (final SubscriptionInfo subscriptionInfo : subscriptionList) {
|
||||
runnable.runForSubscription(subscriptionInfo.getSubscriptionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,20 +17,10 @@
|
||||
|
||||
package com.android.messaging.util;
|
||||
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* Helper class for systrace (see http://developer.android.com/tools/help/systrace.html).<p>
|
||||
* To enable, set log.tag.Bugle_Trace (defined by {@link #TAG} to VERBOSE before
|
||||
* the process starts.<p>
|
||||
* Note that this will run only on JBMR2 or later; on earlier platforms or if the log
|
||||
* tag isn't set, calls to {@link #beginSection(String)} or {@link #endSection()} are no-ops. <p>
|
||||
* Internally, calls dispatch to either a class that actually does work or a class that doesn't.
|
||||
* This avoids Dalvik complaining when it loads the class on earlier platforms that the
|
||||
* opcodes aren't available, and, according to the Dalvik team, using vtable dispatching for
|
||||
* something like this should be faster than if (OsUtil.isAtLeast...()) on each call.
|
||||
*/
|
||||
public final class Trace {
|
||||
private static final String TAG = "Bugle_Trace";
|
||||
@@ -44,8 +35,7 @@ public final class Trace {
|
||||
static {
|
||||
// Use android.util.Log instead of LogUtil here to avoid pulling in Gservices
|
||||
// too early in app startup.
|
||||
if (OsUtil.isAtLeastJB_MR2() &&
|
||||
android.util.Log.isLoggable(TAG, android.util.Log.VERBOSE)) {
|
||||
if (android.util.Log.isLoggable(TAG, android.util.Log.VERBOSE)) {
|
||||
sTrace = new TraceJBMR2();
|
||||
} else {
|
||||
sTrace = new TraceShim();
|
||||
@@ -87,7 +77,6 @@ public final class Trace {
|
||||
/**
|
||||
* Internal class that we use if we really did enable tracing.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private static final class TraceJBMR2 extends AbstractTrace {
|
||||
@Override
|
||||
void beginSection(String sectionName) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user