Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f349da9 authored by Shuo Qian's avatar Shuo Qian
Browse files

Emergency number database config updater

Test: https://paste.googleplex.com/5345498821033984
Bug: 136027884
Change-Id: I0fbd48fe8ef5e008af714312859b513a22679fcb
Merged-In: I0fbd48fe8ef5e008af714312859b513a22679fcb
(cherry picked from commit 8163b80a)
parent 8facba43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5156,6 +5156,7 @@ package android.os {
    field public static final String ACTION_UPDATE_CARRIER_PROVISIONING_URLS = "android.intent.action.UPDATE_CARRIER_PROVISIONING_URLS";
    field public static final String ACTION_UPDATE_CONVERSATION_ACTIONS = "android.intent.action.UPDATE_CONVERSATION_ACTIONS";
    field public static final String ACTION_UPDATE_CT_LOGS = "android.intent.action.UPDATE_CT_LOGS";
    field public static final String ACTION_UPDATE_EMERGENCY_NUMBER_DB = "android.os.action.UPDATE_EMERGENCY_NUMBER_DB";
    field public static final String ACTION_UPDATE_INTENT_FIREWALL = "android.intent.action.UPDATE_INTENT_FIREWALL";
    field public static final String ACTION_UPDATE_LANG_ID = "android.intent.action.UPDATE_LANG_ID";
    field public static final String ACTION_UPDATE_NETWORK_WATCHLIST = "android.intent.action.UPDATE_NETWORK_WATCHLIST";
+15 −0
Original line number Diff line number Diff line
@@ -113,6 +113,21 @@ public final class ConfigUpdate {
    public static final String ACTION_UPDATE_CARRIER_ID_DB
            = "android.os.action.UPDATE_CARRIER_ID_DB";

    /**
    * Broadcast intent action indicating that the updated emergency number database is available.
    * <p>Extra: "VERSION" the numeric version of the new data. Devices should only install if the
    * update version is newer than the current one.
    * <p>Extra: "REQUIRED_HASH" the hash of the current update data.
    * <p>Input: {@link android.content.Intent#getData} is URI of downloaded emergency number file.
    * Devices should pick up the downloaded file and persist to the database
    * {@code com.android.internal.telephony.emergency.EmergencyNumberTracker}.
    *
    * @hide
    */
    @SystemApi
    public static final String ACTION_UPDATE_EMERGENCY_NUMBER_DB =
            "android.os.action.UPDATE_EMERGENCY_NUMBER_DB";

    private ConfigUpdate() {
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -4856,6 +4856,14 @@
            </intent-filter>
        </receiver>

        <receiver android:name="com.android.server.updates.EmergencyNumberDbInstallReceiver"
                  android:permission="android.permission.UPDATE_CONFIG">
            <intent-filter>
                <action android:name="android.os.action.UPDATE_EMERGENCY_NUMBER_DB" />
                <data android:scheme="content" android:host="*" android:mimeType="*/*" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.android.server.MasterClearReceiver"
            android:permission="android.permission.MASTER_CLEAR">
            <intent-filter
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.updates;

import android.content.Context;
import android.content.Intent;
import android.util.Slog;

/**
 * Emergency Number Database Install Receiver.
 */
public class EmergencyNumberDbInstallReceiver extends ConfigUpdateInstallReceiver {

    private static final String TAG = "EmergencyNumberDbInstallReceiver";

    public EmergencyNumberDbInstallReceiver() {
        super("/data/misc/emergencynumberdb", "emergency_number_db", "metadata/", "version");
    }

    @Override
    protected void postInstall(Context context, Intent intent) {
        Slog.i(TAG, "Emergency number database is updated in file partition");
        // TODO Send a notification to EmergencyNumberTracker for updating of emergency number db.
    }
}