Set a text length on the carrier label

Up til now this has been gone unnoticed. Without a text limit the user
could very easily blow up the statusbar to the point that is not usable.

Change-Id: I2813af9e12c6d29e020669e0626faec8422fedbe
Signed-off-by: SagarMakhar <sagarmakhar@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Alex
2020-02-04 22:15:15 +05:30
committed by Hưng Phan
parent df39ae045c
commit 1ff3e9673b

View File

@@ -24,6 +24,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.InputFilter;
import android.text.Spannable;
import android.text.TextUtils;
import android.widget.EditText;
@@ -74,7 +75,9 @@ public class CarrierLabel extends SettingsPreferenceFragment
alert.setMessage(R.string.custom_carrier_label_explain);
// Set an EditText view to get user input
final EditText input = new EditText(getActivity());
int maxLength = 25;
input.setText(TextUtils.isEmpty(mCarrierLabelText) ? "" : mCarrierLabelText);
input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)});
input.setSelection(input.getText().length());
alert.setView(input);
alert.setPositiveButton(getString(android.R.string.ok),