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

Commit ca0f14ec authored by Shuo Qian's avatar Shuo Qian Committed by Gerrit Code Review
Browse files

Merge "Emergency number database config updater"

parents 5ffb4ad6 2f349da9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5157,6 +5157,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
@@ -4868,6 +4868,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.
    }
}