159d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk/*
259d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * Copyright (C) 2017 The Android Open Source Project
359d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk *
459d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
559d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * except in compliance with the License. You may obtain a copy of the License at
659d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk *
759d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk *      http://www.apache.org/licenses/LICENSE-2.0
859d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk *
959d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * Unless required by applicable law or agreed to in writing, software distributed under the
1059d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1159d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * KIND, either express or implied. See the License for the specific language governing
1259d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk * permissions and limitations under the License.
1359d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk */
1459d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
1559d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkpackage com.android.systemui;
1659d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
1759d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport android.app.NotificationManager;
1859d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport android.content.BroadcastReceiver;
1959d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport android.content.Context;
2059d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport android.content.Intent;
2159d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport android.os.Process;
2259d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
2359d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkimport com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
2459d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
2559d86ed2a80364aa27541d8117ccf80551b45e20Jason Monkpublic class SysuiRestartReceiver extends BroadcastReceiver {
2659d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
2759d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk    public static String ACTION = "com.android.systemui.action.RESTART";
2859d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk
2959d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk    @Override
3059d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk    public void onReceive(Context context, Intent intent) {
3159d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk        if (ACTION.equals(intent.getAction())) {
3259d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk            String pkg = intent.getData().toString().substring(10);
3359d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk            NotificationManager.from(context).cancel(pkg, SystemMessage.NOTE_PLUGIN);
3459d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk            Process.killProcess(Process.myPid());
3559d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk        }
3659d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk    }
3759d86ed2a80364aa27541d8117ccf80551b45e20Jason Monk}
38