diff options
author | Danny Baumann <dannybaumann@web.de> | 2018-07-09 11:19:24 +0200 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-12-11 20:08:21 +0200 |
commit | 5e52f9226906e10e9d12d06ab0980d1c78b97335 (patch) | |
tree | 6ce1a8b5eb150f90fd3897df5ccc851ed6f03e8d /java/com/android/incallui/incall/impl | |
parent | 8b870d13cd5e0290c741b2232bae5ac0e4fded00 (diff) | |
download | android_packages_apps_Dialer-5e52f9226906e10e9d12d06ab0980d1c78b97335.tar.gz android_packages_apps_Dialer-5e52f9226906e10e9d12d06ab0980d1c78b97335.tar.bz2 android_packages_apps_Dialer-5e52f9226906e10e9d12d06ab0980d1c78b97335.zip |
Re-add call recording.
Author: Danny Baumann <dannybaumann@web.de>
Date: Mon Jul 9 11:19:24 2018 +0200
Re-add call recording.
Change-Id: I53fadf5754b5b6cc3e9920d57480e470e2305ac0
Author: Markus Gruber <gruberma@outlook.at>
Date: Sat Oct 13 09:17:01 2018 +0200
Allow call recording for Austria
* Call recording is legal in Austria, so it should be available in the UI
Change-Id: Iaae0b222d2a1108572832732471e7e063f84dd1f
Author: Alexandre Pary <alexandre.pary@gmail.com>
Date: Wed Oct 17 11:33:35 2018 +0200
Allow call recording for Belgium
* Call recording is legal in Belgium, so it should be available in the UI
Change-Id: I0d18c5c31aa5fbde08a849932ac0c8088508dbd8
Author: Arekusu Rin <alexmatteotv@gmail.com>
Date: Thu Oct 18 10:20:42 2018 +0200
Allow call recording for Bulgaria.
* Call recording is legal, subject to certain restrictions, in Bulgaria.
Call recording without notification or one side's consent is not a
criminal offense, and only affects the admissibility of said call
recording as evidence.
Change-Id: Ie35f23056914fb2e7639ea509675e21e7fdfab26
(cherry picked from commit 4cec325c31dbe5894ab576b6161065ad0458612d)
Author: Bruno Martins <bgcngm@gmail.com>
Date: Tue Oct 23 21:03:47 2018 +0100
res: Fix malformed XML
* The legal precedent source URL includes double dashes and breaks
aapt2 compilation. Replace it by a shortened one.
Change-Id: Ic1cb1b6af16d27649e36478ca7597b78b93b1338
Author: Arekusu Rin <alexmatteotv@gmail.com>
Date: Thu Oct 25 12:50:57 2018 +0200
Enable or disable call recording for numerous countries via MCC.
* This change handles call recording within the Dialer. Changes were made
to the template of all of the XML files, and all links were changed to
https, where possible. Quotes of the precedents and/or laws can be found
within each country's XML file. Countries' whose status was not changed
are not explicitly mentioned below, despite any changes to their files.
* Call recording is disabled for: Andorra, Iceland, Indonesia, Monaco,
Switzerland, the United States of America and some of its territories -
Guam, Northern Mariana Islands, Puerto Rico and the United States Virgin Islands.
* Call recording is enabled for: Albania, American Samoa, Argentina, Armenia,
Aruba, Belarus, Bonaire, Bosnia and Herzegovina, Brazil, Canada, Chile,
Croatia, Curaçao, Cyprus, Estonia, Faroe Islands, French Guiana, French Polynesia,
Georgia, Greece, Greenland, Guadeloupe, Hungary, India, Ireland, Israel, Japan,
Kosovo, Latvia, Liechtenstein, Lithuania, Luxembourg, Malta, Martinique, Mayotte,
Moldova, Montenegro, Morocco, New Caledonia, New Zealand, North Macedonia, Peru,
Russia, Réunion, Saba, Saint Barthélemy, Saint-Martin, Saint-Pierre-et-Miquelon,
Serbia, Singapore, Sint Eustatius, Sint Maarten, Slovakia, Slovenia, South Africa,
South Korea, Turkey, Ukraine and Wallis-et-Futuna.
Change-Id: Iba5b7028d26cac281099f81bf3d5c21e2ee4d1a9
Author: Arekusu Rin <alexmatteotv@gmail.com>
Date: Wed Jun 12 09:58:05 2019 +0200
Enable Call Recording for Sri Lanka and Costa Rica.
* Call recording is enabled for: Sri Lanka (413) and Costa Rica (712).
* Fixes: Removed newline from Belgium (206) and space from Russia (250).
Change-Id: I4c9ecf41e9fd472b97fff5cd03800414737be87a
Change-Id: Ie9e0af8ccadb1bab1c52a5d905344d0c8fcab92c
Diffstat (limited to 'java/com/android/incallui/incall/impl')
4 files changed, 138 insertions, 4 deletions
diff --git a/java/com/android/incallui/incall/impl/ButtonChooserFactory.java b/java/com/android/incallui/incall/impl/ButtonChooserFactory.java index 757d81352..733dcf96d 100644 --- a/java/com/android/incallui/incall/impl/ButtonChooserFactory.java +++ b/java/com/android/incallui/incall/impl/ButtonChooserFactory.java @@ -117,9 +117,10 @@ class ButtonChooserFactory { mapping.put(InCallButtonIds.BUTTON_MUTE, MappingInfo.builder(0).build()); mapping.put(InCallButtonIds.BUTTON_DIALPAD, MappingInfo.builder(1).build()); mapping.put(InCallButtonIds.BUTTON_AUDIO, MappingInfo.builder(2).build()); - mapping.put(InCallButtonIds.BUTTON_MERGE, MappingInfo.builder(3).setSlotOrder(5).build()); - mapping.put(InCallButtonIds.BUTTON_ADD_CALL, MappingInfo.builder(3).build()); - mapping.put(InCallButtonIds.BUTTON_SWAP_SIM, MappingInfo.builder(4).build()); + mapping.put(InCallButtonIds.BUTTON_RECORD_CALL, MappingInfo.builder(3).build()); + mapping.put(InCallButtonIds.BUTTON_MERGE, MappingInfo.builder(4).setSlotOrder(5).build()); + mapping.put(InCallButtonIds.BUTTON_ADD_CALL, MappingInfo.builder(4).build()); + mapping.put(InCallButtonIds.BUTTON_SWAP_SIM, MappingInfo.builder(5).build()); return mapping; } } diff --git a/java/com/android/incallui/incall/impl/ButtonController.java b/java/com/android/incallui/incall/impl/ButtonController.java index 328ebbe67..2ad3d3e6d 100644 --- a/java/com/android/incallui/incall/impl/ButtonController.java +++ b/java/com/android/incallui/incall/impl/ButtonController.java @@ -16,6 +16,7 @@ package com.android.incallui.incall.impl; +import android.content.res.Resources; import android.graphics.drawable.AnimationDrawable; import android.support.annotation.CallSuper; import android.support.annotation.DrawableRes; @@ -23,6 +24,7 @@ import android.support.annotation.NonNull; import android.support.annotation.StringRes; import android.telecom.CallAudioState; import android.text.TextUtils; +import android.text.format.DateUtils; import android.view.View; import android.view.View.OnClickListener; import com.android.dialer.common.Assert; @@ -411,6 +413,95 @@ interface ButtonController { } } + class CallRecordButtonController implements ButtonController, OnClickListener { + @NonNull private final InCallButtonUiDelegate delegate; + private boolean isEnabled; + private boolean isAllowed; + private boolean isChecked; + private long recordingSeconds; + private CheckableLabeledButton button; + + public CallRecordButtonController(@NonNull InCallButtonUiDelegate delegate) { + this.delegate = delegate; + } + + @Override + public boolean isEnabled() { + return isEnabled; + } + + @Override + public void setEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + if (button != null) { + button.setEnabled(isEnabled); + } + } + + @Override + public boolean isAllowed() { + return isAllowed; + } + + @Override + public void setAllowed(boolean isAllowed) { + this.isAllowed = isAllowed; + if (button != null) { + button.setVisibility(isAllowed ? View.VISIBLE : View.INVISIBLE); + } + } + + @Override + public void setChecked(boolean isChecked) { + this.isChecked = isChecked; + if (button != null) { + button.setChecked(isChecked); + } + } + + @Override + public int getInCallButtonId() { + return InCallButtonIds.BUTTON_RECORD_CALL; + } + + @Override + public void setButton(CheckableLabeledButton button) { + this.button = button; + if (button != null) { + final Resources res = button.getContext().getResources(); + if (isChecked) { + CharSequence duration = DateUtils.formatElapsedTime(recordingSeconds); + button.setLabelText(res.getString(R.string.onscreenCallRecordingText, duration)); + } else { + button.setLabelText(R.string.onscreenCallRecordText); + } + button.setEnabled(isEnabled); + button.setVisibility(isAllowed ? View.VISIBLE : View.INVISIBLE); + button.setChecked(isChecked); + button.setOnClickListener(this); + button.setIconDrawable(R.drawable.quantum_ic_record_white_36); + button.setContentDescription(res.getText( + isChecked ? R.string.onscreenStopCallRecordText : R.string.onscreenCallRecordText)); + button.setShouldShowMoreIndicator(false); + } + } + + public void setRecordingState(boolean recording) { + isChecked = recording; + setButton(button); + } + + public void setRecordingDuration(long durationMs) { + recordingSeconds = (durationMs + 500) / 1000; + setButton(button); + } + + @Override + public void onClick(View v) { + delegate.callRecordClicked(!isChecked); + } + } + class DialpadButtonController extends SimpleCheckableButtonController { public DialpadButtonController(@NonNull InCallButtonUiDelegate delegate) { diff --git a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java index bfc2781a9..ec932b9dc 100644 --- a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java +++ b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java @@ -156,6 +156,10 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { labelView.setText(stringRes); } + public void setLabelText(CharSequence label) { + labelView.setText(label); + } + /** Shows or hides a little down arrow to indicate that the button will pop up a menu. */ public void setShouldShowMoreIndicator(boolean shouldShow) { iconView.setBackground(shouldShow ? backgroundMore : background); diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index 7f20b407f..f5cd38d67 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -54,6 +54,7 @@ import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; import com.android.incallui.contactgrid.ContactGridManager; import com.android.incallui.hold.OnHoldFragment; +import com.android.incallui.incall.impl.ButtonController.CallRecordButtonController; import com.android.incallui.incall.impl.ButtonController.SpeakerButtonController; import com.android.incallui.incall.impl.ButtonController.UpgradeToRttButtonController; import com.android.incallui.incall.impl.InCallButtonGridFragment.OnButtonGridCreatedListener; @@ -95,6 +96,8 @@ public class InCallFragment extends Fragment private int phoneType; private boolean stateRestored; + private static final int REQUEST_CODE_CALL_RECORD_PERMISSION = 1000; + // Add animation to educate users. If a call has enriched calling attachments then we'll // initially show the attachment page. After a delay seconds we'll animate to the button grid. private final Handler handler = new Handler(); @@ -117,7 +120,8 @@ public class InCallFragment extends Fragment || id == InCallButtonIds.BUTTON_MERGE || id == InCallButtonIds.BUTTON_MANAGE_VOICE_CONFERENCE || id == InCallButtonIds.BUTTON_SWAP_SIM - || id == InCallButtonIds.BUTTON_UPGRADE_TO_RTT; + || id == InCallButtonIds.BUTTON_UPGRADE_TO_RTT + || id == InCallButtonIds.BUTTON_RECORD_CALL; } @Override @@ -233,6 +237,7 @@ public class InCallFragment extends Fragment new ButtonController.ManageConferenceButtonController(inCallScreenDelegate)); buttonControllers.add( new ButtonController.SwitchToSecondaryButtonController(inCallScreenDelegate)); + buttonControllers.add(new ButtonController.CallRecordButtonController(inCallButtonUiDelegate)); inCallScreenDelegate.onInCallScreenDelegateInit(this); inCallScreenDelegate.onInCallScreenReady(); @@ -468,6 +473,39 @@ public class InCallFragment extends Fragment } @Override + public void setCallRecordingState(boolean isRecording) { + ((CallRecordButtonController) getButtonController(InCallButtonIds.BUTTON_RECORD_CALL)) + .setRecordingState(isRecording); + } + + @Override + public void setCallRecordingDuration(long durationMs) { + ((CallRecordButtonController) getButtonController(InCallButtonIds.BUTTON_RECORD_CALL)) + .setRecordingDuration(durationMs); + } + + @Override + public void requestCallRecordingPermissions(String[] permissions) { + requestPermissions(permissions, REQUEST_CODE_CALL_RECORD_PERMISSION); + } + + @Override + public void onRequestPermissionsResult(int requestCode, + @NonNull String[] permissions, @NonNull int[] grantResults) { + if (requestCode == REQUEST_CODE_CALL_RECORD_PERMISSION) { + boolean allGranted = grantResults.length > 0; + for (int i = 0; i < grantResults.length; i++) { + allGranted &= grantResults[i] == PackageManager.PERMISSION_GRANTED; + } + if (allGranted) { + inCallButtonUiDelegate.callRecordClicked(true); + } + } else { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + } + + @Override public void updateButtonStates() { // When the incall screen is ready, this method is called from #setSecondary, even though the // incall button ui is not ready yet. This method is called again once the incall button ui is |