现在那个set date 就是今天的日期2014/08/29  怎么改成2014/01/01   等连上wifi或3g时自动更新到今天的日期2014/08/29?

解决方案 »

  1.   

        static Timer timer;
        static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr    // The earliest supported time.  We pick one day into 1970, to
        // give any timezone code room without going into negative time.
      //  private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000;
        private static final long EARLIEST_SUPPORTED_TIME = 1388548800000l;  //kzc    /**
         * Called to initialize native system services.
         */
        private static native void nativeInit();    public static void main(String[] args) {        /*
             * In case the runtime switched since last boot (such as when
             * the old runtime was removed in an OTA), set the system
             * property so that it is in sync. We can't do this in
             * libnativehelper's JniInvocation::Init code where we already
             * had to fallback to a different runtime because it is
             * running as root and we need to be the system user to set
             * the property. http://b/11463182
             */
            SystemProperties.set("persist.sys.dalvik.vm.lib",
                                 VMRuntime.getRuntime().vmLibrary());        if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) {
                // If a device's clock is before 1970 (before 0), a lot of
                // APIs crash dealing with negative numbers, notably
                // java.io.File#setLastModified, so instead we fake it and
                // hope that time from cell towers or NTP fixes it
                // shortly.
           //     Slog.w(TAG, "System clock is before 1970; setting to 1970.");
                Slog.w(TAG, "System clock is before 20140101; setting to 20140101.");  //kzc
                SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
            }
      

  2.   

    我修改这里private static final long EARLIEST_SUPPORTED_TIME = 1388548800000l;  //kzc  时间是2014 /01/01的预设日期,可编译后显示的是2014/07/01因为我是参照别人的一个帖子,上面是写的设置到2014/07/01  但我把时间减了181天,按理应该是2014/01/01   编译后还是 2014/07/01   再改其他时间也是这样 , 这是怎么回事?
      

  3.   

    就是修改framework下面的SystemServer.java