call phone

This commit is contained in:
Jens 2022-10-02 23:26:27 +02:00
parent 900aaf3c8c
commit 135f4594be
14 changed files with 34 additions and 18 deletions

View File

@ -68,7 +68,6 @@
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
@ -173,7 +172,7 @@
<activity android:name=".ActivityManageTriggerTethering" />
<activity android:name=".ActivityManageActionWakeLock" />
<activity android:name=".ActivityManageTriggerSubSystemState" />
<activity android:name=".ActivityManageMakePhoneCall" />
<activity android:name=".ActivityManageActionMakePhoneCall" />
<activity
android:name=".ActivityMainTabLayout"
android:launchMode="singleTask">

View File

@ -281,7 +281,7 @@ public class Action
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.keepDeviceAwake) + " (" + String.valueOf(getParameter1()) + ")");
break;
case makePhoneCall:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.makePhoneCall) + " (" + String.valueOf(getParameter2()) + ")");
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.makePhoneCall));
break;
default:
returnString.append(action.toString());

View File

@ -2190,7 +2190,8 @@ public class Actions
{
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
// intent.setClassName("com.android.phone","com.android.phone.OutgoingCallBroadcaster");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
context.startActivity(intent);
}
}

View File

@ -12,7 +12,7 @@ import androidx.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
public class ActivityManageMakePhoneCall extends Activity
public class ActivityManageActionMakePhoneCall extends Activity
{
EditText etTargetPhoneNumber;
Button bActionMakePhoneCallSave;
@ -47,7 +47,7 @@ public class ActivityManageMakePhoneCall extends Activity
finish();
}
else
Toast.makeText(ActivityManageMakePhoneCall.this, getResources().getText(R.string.enterPhoneNumber), Toast.LENGTH_SHORT).show();
Toast.makeText(ActivityManageActionMakePhoneCall.this, getResources().getText(R.string.enterPhoneNumber), Toast.LENGTH_SHORT).show();
}
});
}

View File

@ -419,7 +419,7 @@ public class ActivityManageRule extends Activity
startActivityForResult(activityEditRunExecutableIntent, requestCodeActionRunExecutableEdit);
break;
case makePhoneCall:
Intent activityEditMakePhoneCallIntent = new Intent(ActivityManageRule.this, ActivityManageMakePhoneCall.class);
Intent activityEditMakePhoneCallIntent = new Intent(ActivityManageRule.this, ActivityManageActionMakePhoneCall.class);
activityEditMakePhoneCallIntent.putExtra(intentNameActionParameter1, a.getParameter1());
activityEditMakePhoneCallIntent.putExtra(intentNameActionParameter2, a.getParameter2());
startActivityForResult(activityEditMakePhoneCallIntent, requestCodeActionMakePhoneCallEdit);
@ -1063,7 +1063,7 @@ public class ActivityManageRule extends Activity
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle(myContext.getResources().getString(R.string.phoneNumber));
alertDialog.setMessage(myContext.getResources().getString(R.string.enterPhoneNumber));
alertDialog.setMessage(myContext.getResources().getString(R.string.enterPhoneNumberBlankForAny));
// Set an EditText view to get user input
final EditText input = new EditText(this);
@ -2006,7 +2006,10 @@ public class ActivityManageRule extends Activity
else if(types[i].toString().equals(Action_Enum.runExecutable.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.script));
else if(types[i].toString().equals(Action_Enum.makePhoneCall.toString()))
{
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.CALL_PHONE))
items.add(new Item(typesLong[i].toString(), R.drawable.phone));
}
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
{
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
@ -2182,7 +2185,7 @@ public class ActivityManageRule extends Activity
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.makePhoneCall.toString()))
{
newAction.setAction(Action_Enum.makePhoneCall);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageMakePhoneCall.class);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionMakePhoneCall.class);
startActivityForResult(intent, requestCodeActionMakePhoneCallAdd);
}
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakelock.toString()))

View File

@ -681,6 +681,7 @@ public class ActivityPermissions extends Activity
break;
case makePhoneCall:
addToArrayListUnique(Manifest.permission.CALL_PHONE, requiredPermissions);
// addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions);
break;
default:
break;
@ -873,6 +874,10 @@ public class ActivityPermissions extends Activity
for(String ruleName : getRulesUsing(Action.Action_Enum.sendTextMessage))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.CALL_PHONE:
for(String ruleName : getRulesUsing(Action.Action_Enum.makePhoneCall))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.FOREGROUND_SERVICE:
usingElements.add(getResources().getString(R.string.startAutomationAsService));
break;

View File

@ -45,7 +45,8 @@
<EditText
android:id="@+id/etTargetPhoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:inputType="phone"/>
</TableRow>

View File

@ -270,7 +270,8 @@
<string name="phoneCall">Telefongespräch</string>
<string name="with">mit</string>
<string name="phoneNumber">Telefonnummer</string>
<string name="enterPhoneNumber">Geben Sie eine Telefonnummer ein. Leer lassen für irgendeine Nummer.</string>
<string name="enterPhoneNumberBlankForAny">Geben Sie eine Telefonnummer ein. Leer lassen für irgendeine Nummer.</string>
<string name="enterPhoneNumber">Geben Sie eine Telefonnummer ein.</string>
<string name="phoneDirection">Wählen Sie die\nGesprächsrichtung</string>
<string name="any">egal</string>
<string name="incoming">eingehend</string>

View File

@ -254,7 +254,8 @@
<string name="headsetDisconnected">Auriculares (tipo: %1$s) desconectados</string>
<string name="phoneCall">Llamada</string>
<string name="phoneNumber">Número de teléfono</string>
<string name="enterPhoneNumber">Inserte numero de teléfono. Vacio para algún número.</string>
<string name="enterPhoneNumberBlankForAny">Inserte numero de teléfono. Vacio para algún número.</string>
<string name="enterPhoneNumber">Inserte numero de teléfono.</string>
<string name="phoneDirection">Elija llamada\nentrante o saliente</string>
<string name="headphoneSimple">Auriculares</string>
<string name="headphoneSelectType">Elija tipo de auriculares</string>

View File

@ -273,7 +273,8 @@
<string name="phoneCall">Appel téléphonique</string>
<string name="with">avec</string>
<string name="phoneNumber">Numéro de téléphone</string>
<string name="enterPhoneNumber">Saisissez un numéro de téléphone. Laissez vide pour n\'importe quel numéro.</string>
<string name="enterPhoneNumberBlankForAny">Saisissez un numéro de téléphone. Laissez vide pour n\'importe quel numéro.</string>
<string name="enterPhoneNumber">Saisissez un numéro de téléphone.</string>
<string name="phoneDirection">Sélectionnez le type \nd\'appel</string>
<string name="any">tout</string>
<string name="incoming">entrant</string>

View File

@ -179,7 +179,8 @@
<string name="enterAname">Inserisci un nome.</string>
<string name="enterNameForIntentPair">Definisci un nome per la coppia dell\'Intent</string>
<string name="enterPackageName">Inserisci un nome di pacchetto che sia valido.</string>
<string name="enterPhoneNumber">Inserisci un numero di telefono. Lascia vuoto per accettare qualsiasi numero.</string>
<string name="enterPhoneNumberBlankForAny">Inserisci un numero di telefono. Lascia vuoto per accettare qualsiasi numero.</string>
<string name="enterPhoneNumber">Inserisci un numero di telefono.</string>
<string name="enterValidAction">Inserisci una azione valida</string>
<string name="enterValidReferenceValue">Inserisci un valore di riferimento valido.</string>
<string name="enterValueForIntentPair">Definisci un valore per la coppia dell\'Intent.</string>

View File

@ -268,7 +268,8 @@
<string name="phoneCall">Telefoongesprek</string>
<string name="with">met</string>
<string name="phoneNumber">Telefoonnummer</string>
<string name="enterPhoneNumber">Voer telefoonnummer in. Laat leeg voor een willekeurig nummer.</string>
<string name="enterPhoneNumberBlankForAny">Voer telefoonnummer in. Laat leeg voor een willekeurig nummer.</string>
<string name="enterPhoneNumber">Voer telefoonnummer in.</string>
<string name="phoneDirection">Selecteer gespreksrichting</string>
<string name="any">een willekeurig</string>
<string name="incoming">binnenkomend</string>

View File

@ -302,7 +302,8 @@
<string name="phoneCall">Телефонный звонок</string>
<string name="with">с</string>
<string name="phoneNumber">Номер телефона</string>
<string name="enterPhoneNumber">Введите номер телефона. Оставьте пустым для любого номера телефона.</string>
<string name="enterPhoneNumberBlankForAny">Введите номер телефона. Оставьте пустым для любого номера телефона.</string>
<string name="enterPhoneNumber">Введите номер телефона.</string>
<string name="phoneDirection">Выберите вызов\nнаправление</string>
<string name="any">Любой</string>
<string name="incoming">входящий</string>

View File

@ -341,7 +341,8 @@
<string name="phoneCall">Phone call</string>
<string name="with">with</string>
<string name="phoneNumber">Phone number</string>
<string name="enterPhoneNumber">Enter phone number. Leave empty for any number.</string>
<string name="enterPhoneNumberBlankForAny">Enter phone number. Leave empty for any number.</string>
<string name="enterPhoneNumber">Enter phone number.</string>
<string name="phoneDirection">Select call\ndirection</string>
<string name="any">any</string>
<string name="incoming">incoming</string>