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

Commit 59ed568f authored by Narayan Kamath's avatar Narayan Kamath Committed by Android Git Automerger
Browse files

am cd4874cf: am d265bcc4: Merge "Inform libcore of time format pref. changes."

* commit 'cd4874cf':
  Inform libcore of time format pref. changes.
parents 1aa55954 cd4874cf
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -68,6 +68,7 @@ import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.AndroidRuntimeException;
import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
@@ -106,6 +107,7 @@ import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.InetAddress;
import java.security.Security;
import java.security.Security;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Locale;
import java.util.Locale;
@@ -1095,6 +1097,11 @@ public final class ActivityThread {
        public void scheduleInstallProvider(ProviderInfo provider) {
        public void scheduleInstallProvider(ProviderInfo provider) {
            sendMessage(H.INSTALL_PROVIDER, provider);
            sendMessage(H.INSTALL_PROVIDER, provider);
        }
        }

        @Override
        public final void updateTimePrefs(boolean is24Hour) {
            DateFormat.set24HourTimePref(is24Hour);
        }
    }
    }


    private class H extends Handler {
    private class H extends Handler {
@@ -1144,6 +1151,7 @@ public final class ActivityThread {
        public static final int REQUEST_ASSIST_CONTEXT_EXTRAS = 143;
        public static final int REQUEST_ASSIST_CONTEXT_EXTRAS = 143;
        public static final int TRANSLUCENT_CONVERSION_COMPLETE = 144;
        public static final int TRANSLUCENT_CONVERSION_COMPLETE = 144;
        public static final int INSTALL_PROVIDER        = 145;
        public static final int INSTALL_PROVIDER        = 145;

        String codeToString(int code) {
        String codeToString(int code) {
            if (DEBUG_MESSAGES) {
            if (DEBUG_MESSAGES) {
                switch (code) {
                switch (code) {
@@ -4189,6 +4197,11 @@ public final class ActivityThread {
                Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory");
                Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory");
            }
            }
        }
        }


        final boolean is24Hr = "24".equals(mCoreSettings.getString(Settings.System.TIME_12_24));
        DateFormat.set24HourTimePref(is24Hr);

        /**
        /**
         * For system applications on userdebug/eng builds, log stack
         * For system applications on userdebug/eng builds, log stack
         * traces of disk and network access to dropbox for analysis.
         * traces of disk and network access to dropbox for analysis.
+18 −0
Original line number Original line Diff line number Diff line
@@ -627,6 +627,15 @@ public abstract class ApplicationThreadNative extends Binder
            reply.writeNoException();
            reply.writeNoException();
            return true;
            return true;
        }
        }

        case UPDATE_TIME_PREFS_TRANSACTION:
        {
            data.enforceInterface(IApplicationThread.descriptor);
            byte is24Hour = data.readByte();
            updateTimePrefs(is24Hour == (byte) 1);
            reply.writeNoException();
            return true;
        }
        }
        }


        return super.onTransact(code, data, reply, flags);
        return super.onTransact(code, data, reply, flags);
@@ -1266,4 +1275,13 @@ class ApplicationThreadProxy implements IApplicationThread {
        mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
        mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
        data.recycle();
        data.recycle();
    }
    }

    @Override
    public void updateTimePrefs(boolean is24Hour) throws RemoteException {
        Parcel data = Parcel.obtain();
        data.writeInterfaceToken(IApplicationThread.descriptor);
        data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
        mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
        data.recycle();
    }
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -138,6 +138,7 @@ public interface IApplicationThread extends IInterface {
            throws RemoteException;
            throws RemoteException;
    void setProcessState(int state) throws RemoteException;
    void setProcessState(int state) throws RemoteException;
    void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
    void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
    void updateTimePrefs(boolean is24Hour) throws RemoteException;


    String descriptor = "android.app.IApplicationThread";
    String descriptor = "android.app.IApplicationThread";


@@ -191,4 +192,5 @@ public interface IApplicationThread extends IInterface {
    int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
    int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
    int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
    int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
    int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
    int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
    int UPDATE_TIME_PREFS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51;
}
}
+9 −0
Original line number Original line Diff line number Diff line
@@ -3331,6 +3331,15 @@ public class Intent implements Parcelable, Cloneable {
    public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY
    public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY
            = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
            = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";


    /**
     * Optional boolean extra for {@link #ACTION_TIME_CHANGED} that indicates the
     * user has set their time format preferences to the 24 hour format.
     *
     * @hide for internal use only.
     */
    public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT =
            "android.intent.extra.TIME_PREF_24_HOUR_FORMAT";

    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // Intent flags (see mFlags variable).
    // Intent flags (see mFlags variable).
+28 −2
Original line number Original line Diff line number Diff line
@@ -1058,6 +1058,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    static final int IMMERSIVE_MODE_LOCK_MSG = 37;
    static final int IMMERSIVE_MODE_LOCK_MSG = 37;
    static final int PERSIST_URI_GRANTS_MSG = 38;
    static final int PERSIST_URI_GRANTS_MSG = 38;
    static final int REQUEST_ALL_PSS_MSG = 39;
    static final int REQUEST_ALL_PSS_MSG = 39;
    static final int UPDATE_TIME = 40;
    static final int FIRST_ACTIVITY_STACK_MSG = 100;
    static final int FIRST_ACTIVITY_STACK_MSG = 100;
    static final int FIRST_BROADCAST_QUEUE_MSG = 200;
    static final int FIRST_BROADCAST_QUEUE_MSG = 200;
@@ -1668,6 +1669,22 @@ public final class ActivityManagerService extends ActivityManagerNative
                requestPssAllProcsLocked(SystemClock.uptimeMillis(), true, false);
                requestPssAllProcsLocked(SystemClock.uptimeMillis(), true, false);
                break;
                break;
            }
            }
            case UPDATE_TIME: {
                synchronized (ActivityManagerService.this) {
                    for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
                        ProcessRecord r = mLruProcesses.get(i);
                        if (r.thread != null) {
                            try {
                                r.thread.updateTimePrefs(msg.arg1 == 0 ? false : true);
                            } catch (RemoteException ex) {
                                Slog.w(TAG, "Failed to update preferences for: " + r.info.processName);
                            }
                        }
                    }
                }
                break;
            }
            }
            }
        }
        }
    };
    };
@@ -13438,11 +13455,20 @@ public final class ActivityManagerService extends ActivityManagerNative
         * of all currently running processes. This message will get queued up before the broadcast
         * of all currently running processes. This message will get queued up before the broadcast
         * happens.
         * happens.
         */
         */
        if (intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
        if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
            mHandler.sendEmptyMessage(UPDATE_TIME_ZONE);
            mHandler.sendEmptyMessage(UPDATE_TIME_ZONE);
        }
        }
        if (intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) {
        /*
         * If the user set the time, let all running processes know.
         */
        if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) {
            final int is24Hour = intent.getBooleanExtra(
                    Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 : 0;
            mHandler.sendMessage(mHandler.obtainMessage(UPDATE_TIME, is24Hour, 0));
        }
        if (Intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) {
            mHandler.sendEmptyMessage(CLEAR_DNS_CACHE_MSG);
            mHandler.sendEmptyMessage(CLEAR_DNS_CACHE_MSG);
        }
        }
Loading