Android->setting:add SchedulePowerOnOff function
This commit is contained in:
@ -2254,9 +2254,7 @@
|
||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
<receiver android:name=".BootReceiver"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
@ -2264,6 +2262,11 @@
|
||||
</intent-filter>
|
||||
|
||||
</receiver>
|
||||
<receiver android:name="ScheduleOnOffReceiver" android:process=":remote">
|
||||
<intent-filter>
|
||||
<action android:name="android.timerswitch.run_power_off"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!--$_rbox_$_modify_$_end-->
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- schedule power on off start -->
|
||||
<string name="schedule_power_on_off_settings_title">"定时开关机"</string>
|
||||
</resources>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Schedule power on/off settings -->
|
||||
<!-- Main Settings screen setting option name to go into the power on/off settings-->
|
||||
<string name="schedule_power_on_off_settings_title">定時開/關機</string>
|
||||
</resources>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Schedule power on/off settings -->
|
||||
<!-- Main Settings screen setting option name to go into the power on/off settings-->
|
||||
<string name="schedule_power_on_off_settings_title">定時開/關機</string>
|
||||
</resources>
|
||||
5
packages/apps/Settings/res/values/tchip_strings.xml
Executable file
5
packages/apps/Settings/res/values/tchip_strings.xml
Executable file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Main Settings screen setting option name to go into the power on&off settings-->
|
||||
<string name="schedule_power_on_off_settings_title">Scheduled power on & off</string>
|
||||
</resources>
|
||||
@ -234,7 +234,14 @@
|
||||
android:fragment="com.android.settings.DateTimeSettings"
|
||||
android:icon="@drawable/ic_settings_date_time"
|
||||
/>
|
||||
|
||||
<!--Scheduled power on&off-->
|
||||
<dashboard-tile
|
||||
android:id="@+id/power_settings"
|
||||
android:icon="@drawable/ic_settings_schpwronoff"
|
||||
android:title="@string/schedule_power_on_off_settings_title">
|
||||
<intent android:action="com.android.settings.SCHEDULE_POWER_ON_OFF_SETTING" />
|
||||
</dashboard-tile>
|
||||
|
||||
<!-- Accessibility feedback -->
|
||||
<dashboard-tile
|
||||
android:id="@+id/accessibility_settings"
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* @author lql
|
||||
*
|
||||
*/
|
||||
public class ScheduleOnOffReceiver extends BroadcastReceiver {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent data) {
|
||||
Log.v("sjf",data.getAction());
|
||||
if(data.getAction().equals("android.timerswitch.run_power_off"))
|
||||
{
|
||||
// Toast.makeText(arg0, "will power_off", Toast.LENGTH_SHORT).show();
|
||||
Intent newIntent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
arg0.startActivity(newIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user