Пример #1
0
  private int getModemType() {
    String mt;
    if (mSimType == PhoneConstants.GEMINI_SIM_1) {
      mt = SystemProperties.get("gsm.baseband.capability");
      Xlog.i(TAG, "gsm.baseband.capability " + mt);
    } else {
      mt = SystemProperties.get("gsm.baseband.capability2");
      Xlog.i(TAG, "gsm.baseband.capability2 " + mt);
    }
    int mode = MODEM_NO3G;

    if (mt == null) {
      mode = MODEM_NO3G;
    } else {
      try {
        int mask = Integer.valueOf(mt);
        if ((mask & MODEM_MASK_TDSCDMA) == MODEM_MASK_TDSCDMA) {
          mode = MODEM_TD;
        } else if ((mask & MODEM_MASK_WCDMA) == MODEM_MASK_WCDMA) {
          mode = MODEM_FDD;
        } else {
          mode = MODEM_NO3G;
        }
      } catch (NumberFormatException e) {
        mode = MODEM_NO3G;
      }
    }
    return mode;
  }
  public static ComponentName getErrorReportReceiver(
      Context context, String packageName, int appFlags) {
    // check if error reporting is enabled in secure settings
    int enabled =
        Settings.Secure.getInt(
            context.getContentResolver(), Settings.Secure.SEND_ACTION_APP_ERROR, 0);
    if (enabled == 0) {
      return null;
    }

    PackageManager pm = context.getPackageManager();

    // look for receiver in the installer package
    String candidate = pm.getInstallerPackageName(packageName);
    ComponentName result = getErrorReportReceiver(pm, packageName, candidate);
    if (result != null) {
      return result;
    }

    // if the error app is on the system image, look for system apps
    // error receiver
    if ((appFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
      candidate = SystemProperties.get(SYSTEM_APPS_ERROR_RECEIVER_PROPERTY);
      result = getErrorReportReceiver(pm, packageName, candidate);
      if (result != null) {
        return result;
      }
    }

    // if there is a default receiver, try that
    candidate = SystemProperties.get(DEFAULT_ERROR_RECEIVER_PROPERTY);
    return getErrorReportReceiver(pm, packageName, candidate);
  }
Пример #3
0
 /**
  * Whether the SVLTE AP-IRAT Support.
  *
  * @return true if ap-irat support.
  */
 public static final boolean isApIratSupport() {
   if (SystemProperties.get("ro.mtk_svlte_support").equals("1")
       && !SystemProperties.get("ro.c2k.md.irat.support").equals("1")) {
     return true;
   } else {
     return false;
   }
 }
Пример #4
0
  private void initSimState() {
    if (FeatureOption.MTK_GEMINI_SUPPORT) {
      Intent it = getIntent();
      mSimId = it.getIntExtra("simId", SIM_CARD_UNDEFINED);
      if (SIMInfo.getInsertedSIMCount(this) > 1) {
        SIMInfo siminfo = SIMInfo.getSIMInfoBySlot(this, mSimId);
        if (siminfo != null) {
          setTitle(siminfo.mDisplayName);
        }
      }
      Xlog.d(TAG, "GEMINI_SIM_ID_KEY = " + mSimId);
    } else {
      Xlog.w(TAG, "Not support GEMINI");
      mSimId = SIM_CARD_SINGLE;
    }
    switch (mSimId) {
      case SIM_CARD_SINGLE:
        mUri = Telephony.Carriers.CONTENT_URI;
        mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "-1");
        mDefaultApnUri = DEFAULTAPN_URI;
        mRestoreCarrierUri = PREFERAPN_URI;
        break;
      case SIM_CARD_1:
        mUri = Telephony.Carriers.SIM1Carriers.CONTENT_URI;
        mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "-1");
        mDefaultApnUri = DEFAULTAPN_URI_GEMINI_SIM1;
        mRestoreCarrierUri = PREFERAPN_URI_GEMINI_SIM1;
        break;
      case SIM_CARD_2:
        mUri = Telephony.Carriers.SIM2Carriers.CONTENT_URI;
        mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC_2, "-1");
        mDefaultApnUri = DEFAULTAPN_URI_GEMINI_SIM2;
        mRestoreCarrierUri = PREFERAPN_URI_GEMINI_SIM2;
        break;

      default:
        Xlog.i(TAG, "Incorrect sim id ");
        if (FeatureOption.MTK_GEMINI_SUPPORT) {
          Intent intent = new Intent();
          intent.setClassName("com.android.phone", "com.mediatek.settings.MultipleSimActivity");
          intent.putExtra("TARGET_CLASS", "com.android.settings.ApnSettings");
          startActivity(intent);
        }
        finish();
        break;
    }

    Xlog.d(TAG, "mNumeric " + mNumeric);
    Xlog.d(TAG, "mUri = " + mUri);
  }
Пример #5
0
 /**
  * Whether the svlte feature support.
  *
  * @return the svlte feature support or not
  */
 public static final boolean isMediatekSVLteDcSupport() {
   if (SystemProperties.get(MTK_SVLTE_SUPPORT).equals("1")) {
     return true;
   } else {
     return false;
   }
 }
 /**
  * while receiving one sms, check the sms count to see whether it reaches the max count.
  *
  * @param threadId
  * @param context
  * @param flag indicate the operator (increase/decrease)
  * @return true if the count is less than the max size, otherwise false.
  */
 public void isFull(Long threadId, Context context, int flag) {
   try {
     ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
     if (phone != null) {
       if (phone.isTestIccCard()
           || (Integer.parseInt(SystemProperties.get("gsm.gcf.testmode", "0")) == 2)) {
         Log.d(TAG, "Now using test icc card...");
         if (flag == OP_FLAG_INCREASE) {
           if (get(threadId, context) >= THREAD_MAX_SIZE) {
             Log.d(TAG, "Storage is full. send notification...");
             SmsManager.getDefault().setSmsMemoryStatus(false);
           }
         } else if (flag == OP_FLAG_DECREASE) {
           if (get(threadId, context) < THREAD_MAX_SIZE) {
             Log.d(TAG, "Storage is available. send notification...");
             SmsManager.getDefault().setSmsMemoryStatus(true);
           }
         }
       }
     } else {
       Log.d(TAG, "Telephony service is not available!");
     }
   } catch (Exception ex) {
     Log.e(TAG, " " + ex.getMessage());
   }
 }
Пример #7
0
    private EGLConfig chooseEglConfig() {
      EGLConfig[] configs = new EGLConfig[1];
      int[] configsCount = new int[1];
      int[] configSpec = getConfig(sDirtyRegions);

      // Debug
      final String debug = SystemProperties.get(PRINT_CONFIG_PROPERTY, "");
      if ("all".equalsIgnoreCase(debug)) {
        sEgl.eglChooseConfig(sEglDisplay, configSpec, null, 0, configsCount);

        EGLConfig[] debugConfigs = new EGLConfig[configsCount[0]];
        sEgl.eglChooseConfig(sEglDisplay, configSpec, debugConfigs, configsCount[0], configsCount);

        for (EGLConfig config : debugConfigs) {
          printConfig(config);
        }
      }

      if (!sEgl.eglChooseConfig(sEglDisplay, configSpec, configs, 1, configsCount)) {
        throw new IllegalArgumentException(
            "eglChooseConfig failed " + GLUtils.getEGLErrorString(sEgl.eglGetError()));
      } else if (configsCount[0] > 0) {
        if ("choice".equalsIgnoreCase(debug)) {
          printConfig(configs[0]);
        }
        return configs[0];
      }

      return null;
    }
 /**
  * Returns an identifier for the current build that can be used to detect likely changes to
  * framework resources. The build identifier is made of several distinct values:
  *
  * <p>build fingerprint/framework version name/file size of framework resources apk
  *
  * <p>Only the build fingerprint should be necessary on user builds but the other values are
  * useful to detect changes on eng builds during development.
  *
  * <p>This identifier does not attempt to be exact: a new identifier does not necessarily mean the
  * preloaded drawables have changed. It is important however that whenever the list of preloaded
  * drawables changes, this identifier changes as well.
  *
  * @see #checkBuildIdentifier(java.io.BufferedReader, String)
  */
 private String getBuildIdentifier(String versionName) {
   return SystemProperties.get("ro.build.fingerprint", "")
       + '/'
       + versionName
       + '/'
       + String.valueOf(getFrameworkResourcesFile().length());
 }
  public void onAccountsChanged(String[] accountsArray) {
    if (!"yes".equals(SystemProperties.get("ro.config.sync"))) {
      return;
    }

    // - Get a cursor (A) over all selected calendars over all accounts
    // - Get a cursor (B) over all subscribed feeds for calendar
    // - If an item is in A but not B then add a subscription
    // - If an item is in B but not A then remove the subscription

    ContentResolver cr = getContext().getContentResolver();
    Cursor cursorA = null;
    Cursor cursorB = null;
    try {
      cursorA =
          Calendar.Calendars.query(
              cr,
              null /* projection */,
              Calendar.Calendars.SELECTED + "=1",
              CALENDAR_KEY_SORT_ORDER);
      int urlIndexA = cursorA.getColumnIndexOrThrow(Calendar.Calendars.URL);
      int accountIndexA = cursorA.getColumnIndexOrThrow(Calendar.Calendars._SYNC_ACCOUNT);
      cursorB =
          SubscribedFeeds.Feeds.query(
              cr,
              FEEDS_KEY_COLUMNS,
              SubscribedFeeds.Feeds.AUTHORITY + "=?",
              new String[] {Calendar.AUTHORITY},
              FEEDS_KEY_SORT_ORDER);
      int urlIndexB = cursorB.getColumnIndexOrThrow(SubscribedFeeds.Feeds.FEED);
      int accountIndexB = cursorB.getColumnIndexOrThrow(SubscribedFeeds.Feeds._SYNC_ACCOUNT);
      for (CursorJoiner.Result joinerResult :
          new CursorJoiner(cursorA, CALENDAR_KEY_COLUMNS, cursorB, FEEDS_KEY_COLUMNS)) {
        switch (joinerResult) {
          case LEFT:
            SubscribedFeeds.addFeed(
                cr,
                cursorA.getString(urlIndexA),
                cursorA.getString(accountIndexA),
                Calendar.AUTHORITY,
                CalendarClient.SERVICE);
            break;
          case RIGHT:
            SubscribedFeeds.deleteFeed(
                cr,
                cursorB.getString(urlIndexB),
                cursorB.getString(accountIndexB),
                Calendar.AUTHORITY);
            break;
          case BOTH:
            // do nothing, since the subscription already exists
            break;
        }
      }
    } finally {
      // check for null in case an exception occurred before the cursors got created
      if (cursorA != null) cursorA.close();
      if (cursorB != null) cursorB.close();
    }
  }
  /**
   * Invoked on each preference click in this hierarchy, overrides PreferenceActivity's
   * implementation. Used to make sure we track the preference click events.
   */
  @Override
  public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
    /** TODO: Refactor and get rid of the if's using subclasses */
    if (mGsmUmtsOptions != null && mGsmUmtsOptions.preferenceTreeClick(preference) == true) {
      return true;
    } else if (mCdmaOptions != null && mCdmaOptions.preferenceTreeClick(preference) == true) {
      if (Boolean.parseBoolean(SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {

        mClickedPreference = preference;

        // In ECM mode launch ECM app dialog
        startActivityForResult(
            new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null),
            REQUEST_CODE_EXIT_ECM);
      }
      return true;
    } else if (preference == mButtonPreferredNetworkMode) {
      // displays the value taken from the Settings.System
      int settingsNetworkMode = getPreferredNetworkMode();
      mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
      return true;
    } else {
      // if the button is anything but the simple toggle preference,
      // we'll need to disable all preferences to reject all click
      // events until the sub-activity's UI comes up.
      preferenceScreen.setEnabled(false);
      // Let the intents be launched by the Preference manager
      return false;
    }
  }
Пример #11
0
  /**
   * @param preference The key for the Preference item
   * @param property The system property to fetch
   * @param alt The default value, if the property doesn't exist
   */
  private void setSummary(String preference, String property, String alt) {
    try {
      findPreference(preference).setSummary(SystemProperties.get(property, alt));
    } catch (RuntimeException e) {

    }
  }
  private static void initRndisAddress() {
    // configure RNDIS ethernet address based on our serial number using the same algorithm
    // we had been previously using in kernel board files
    final int ETH_ALEN = 6;
    int address[] = new int[ETH_ALEN];
    // first byte is 0x02 to signify a locally administered address
    address[0] = 0x02;

    String serial = SystemProperties.get("ro.serialno", "1234567890ABCDEF");
    int serialLength = serial.length();
    // XOR the USB serial across the remaining 5 bytes
    for (int i = 0; i < serialLength; i++) {
      address[i % (ETH_ALEN - 1) + 1] ^= (int) serial.charAt(i);
    }
    String addrString =
        String.format(
            Locale.US,
            "%02X:%02X:%02X:%02X:%02X:%02X",
            address[0],
            address[1],
            address[2],
            address[3],
            address[4],
            address[5]);
    try {
      FileUtils.stringToFile(RNDIS_ETH_ADDR_PATH, addrString);
    } catch (IOException e) {
      Slog.e(TAG, "failed to write to " + RNDIS_ETH_ADDR_PATH);
    }
  }
Пример #13
0
 private void getIpoLedStatus() {
   if ("1".equals(SystemProperties.get("sys.ipo.ledon"))) {
     ipo_led_on = true;
   } else if ("0".equals(SystemProperties.get("sys.ipo.ledon"))) {
     ipo_led_off = true;
   }
   if (DEBUG) {
     Slog.d(
         TAG,
         ">>>>>>>getIpoLedStatus ipo_led_on = "
             + ipo_led_on
             + ",  ipo_led_off = "
             + ipo_led_off
             + "<<<<<<<");
   }
 }
Пример #14
0
 // Returns the current state of the system property that controls
 // strictmode flashes.  One of:
 //    0: not explicitly set one way or another
 //    1: on
 //    2: off
 private int currentStrictModeActiveIndex() {
   if (TextUtils.isEmpty(SystemProperties.get(StrictMode.VISUAL_PROPERTY))) {
     return 0;
   }
   boolean enabled = SystemProperties.getBoolean(StrictMode.VISUAL_PROPERTY, false);
   return enabled ? 1 : 2;
 }
Пример #15
0
 public static boolean isAdVideoFinish() {
   if ("1".equals(SystemProperties.get("mstar.videoadvert.finished", "0"))) {
     return true;
   } else {
     return false;
   }
 }
Пример #16
0
  private boolean testEncrypt() {
    String devicetest = SystemProperties.get("ro.esky.devicetest");

    if (devicetest.equals("esky")) {
      return true;
    }
    return false;
  }
Пример #17
0
  String getSimOperator() {
    String oprator = null;

    switch (mSlot) {
      case -1:
      case 0:
        oprator = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "-1");
        break;
      case 1:
        oprator = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC_2, "-1");
        break;
      default:
        break;
    }

    return oprator;
  }
 private String getDefaultFunctions() {
   String func =
       SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY, UsbManager.USB_FUNCTION_NONE);
   if (UsbManager.USB_FUNCTION_NONE.equals(func)) {
     func = UsbManager.USB_FUNCTION_MTP;
   }
   return func;
 }
  private synchronized void onDunDialupReq() {
    ConnectivityManager connmgr;
    String response;
    String[] dnsServers;

    dnsServers = new String[2];
    connmgr = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo MobileInfo = connmgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    NetworkInfo WifiInfo = connmgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    if (MobileInfo == null && WifiInfo == null) {
      Log.w(TAG, "dialup request, get network info failed");
      response = "unknown";
      dunDialupRspNative(response, BLUETOOTH_IFACE_ADDR_START, dnsServers);
      return;
    }
    NetworkInfo.State MobileState = NetworkInfo.State.UNKNOWN;
    NetworkInfo.State WifiState = NetworkInfo.State.UNKNOWN;

    if (MobileInfo != null) MobileState = MobileInfo.getState();
    if (WifiInfo != null) WifiState = WifiInfo.getState();

    if (MobileState == NetworkInfo.State.CONNECTED || WifiState == NetworkInfo.State.CONNECTED) {
      NetworkInfo.State state =
          (MobileState == NetworkInfo.State.CONNECTED) ? MobileState : WifiState;
      if (DBG) log("startUsingNetworkFeature: (" + state + ")");
      response = "active";
      dnsServers[0] = SystemProperties.get("net.dns1");
      dnsServers[1] = SystemProperties.get("net.dns2");
      if (DBG) log("Network connected, DNS1=" + dnsServers[0] + ", " + "DNS2=" + dnsServers[1]);
      if (dnsServers[1].isEmpty()) {
        dnsServers[1] = "8.8.8.8";
      }
      if (DBG) log("Network connected, DNS2=" + dnsServers[1] + ", " + "DNS1=" + dnsServers[0]);
    } else if (MobileState == NetworkInfo.State.SUSPENDED
        || WifiState == NetworkInfo.State.SUSPENDED) {
      response = "busy";
    } else if (MobileState == NetworkInfo.State.DISCONNECTED
        || WifiState == NetworkInfo.State.DISCONNECTED) {
      response = "unavailable";
    } else {
      response = "unknown";
    }
    if (DBG) log("dunDialupRspNative response: (" + response + ")");
    dunDialupRspNative(response, BLUETOOTH_IFACE_ADDR_START, dnsServers);
  }
 /** @hide */
 public static int staticGetMemoryClass() {
   // Really brain dead right now -- just take this from the configured
   // vm heap size, and assume it is in megabytes and thus ends with "m".
   String vmHeapSize = SystemProperties.get("dalvik.vm.heapgrowthlimit", "");
   if (vmHeapSize != null && !"".equals(vmHeapSize)) {
     return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length() - 1));
   }
   return staticGetLargeMemoryClass();
 }
 /** Return current state of given service. */
 public static State getState(String service) {
   final String rawState = SystemProperties.get("init.svc." + service);
   final State state = sStates.get(rawState);
   if (state != null) {
     return state;
   } else {
     return State.STOPPED;
   }
 }
 public static String getSystemProp(String prop, String def) {
   String result = null;
   try {
     result = SystemProperties.get(prop, def);
   } catch (IllegalArgumentException iae) {
     Log.e(TAG, "Failed to get prop: " + prop);
   }
   return result == null ? def : result;
 }
  private static final void commonInit() {
    if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!");

    /*
     * set handlers; these apply to all threads in the VM. Apps can replace
     * the default handler, but not the pre handler.
     */
    Thread.setUncaughtExceptionPreHandler(new LoggingHandler());
    Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler());

    /*
     * Install a TimezoneGetter subclass for ZoneInfo.db
     */
    TimezoneGetter.setInstance(
        new TimezoneGetter() {
          @Override
          public String getId() {
            return SystemProperties.get("persist.sys.timezone");
          }
        });
    TimeZone.setDefault(null);

    /*
     * Sets handler for java.util.logging to use Android log facilities.
     * The odd "new instance-and-then-throw-away" is a mirror of how
     * the "java.util.logging.config.class" system property works. We
     * can't use the system property here since the logger has almost
     * certainly already been initialized.
     */
    LogManager.getLogManager().reset();
    new AndroidConfig();

    /*
     * Sets the default HTTP User-Agent used by HttpURLConnection.
     */
    String userAgent = getDefaultUserAgent();
    System.setProperty("http.agent", userAgent);

    /*
     * Wire socket tagging to traffic stats.
     */
    NetworkManagementSocketTagger.install();

    /*
     * If we're running in an emulator launched with "-trace", put the
     * VM into emulator trace profiling mode so that the user can hit
     * F9/F10 at any time to capture traces.  This has performance
     * consequences, so it's not something you want to do always.
     */
    String trace = SystemProperties.get("ro.kernel.android.tracing");
    if (trace.equals("1")) {
      Slog.i(TAG, "NOTE: emulator trace profiling enabled");
      Debug.enableEmulatorTraceOutput();
    }

    initialized = true;
  }
Пример #24
0
  private File dumpKernelStackTraces() {
    String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
    if (tracesPath == null || tracesPath.length() == 0) {
      return null;
    }

    native_dumpKernelStacks(tracesPath);
    return new File(tracesPath);
  }
Пример #25
0
  /** Takes a screenshot of the current display and shows an animation. */
  void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarVisible) {
    // We need to orient the screenshot correctly (and the Surface api seems to take screenshots
    // only in the natural orientation of the device :!)
    mDisplay.getRealMetrics(mDisplayMetrics);
    float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
    // float degrees = getDegreesForRotation(mDisplay.getRotation());
    int value = mDisplay.getRotation();
    String hwRotation = SystemProperties.get("ro.sf.hwrotation", "0");
    if (hwRotation.equals("270") || hwRotation.equals("90")) {
      value = (value + 3) % 4;
    }
    float degrees = getDegreesForRotation(value);
    boolean requiresRotation = (degrees > 0);
    if (requiresRotation) {
      // Get the dimensions of the device in its native orientation
      mDisplayMatrix.reset();
      mDisplayMatrix.preRotate(-degrees);
      mDisplayMatrix.mapPoints(dims);
      dims[0] = Math.abs(dims[0]);
      dims[1] = Math.abs(dims[1]);
    }

    // Take the screenshot
    mScreenBitmap = Surface.screenshot((int) dims[0], (int) dims[1]);
    if (mScreenBitmap == null) {
      notifyScreenshotError(mContext, mNotificationManager);
      finisher.run();
      return;
    }

    if (requiresRotation) {
      // Rotate the screenshot to the current orientation
      Bitmap ss =
          Bitmap.createBitmap(
              mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels, Bitmap.Config.ARGB_8888);
      Canvas c = new Canvas(ss);
      c.translate(ss.getWidth() / 2, ss.getHeight() / 2);
      c.rotate(degrees);
      c.translate(-dims[0] / 2, -dims[1] / 2);
      c.drawBitmap(mScreenBitmap, 0, 0, null);
      c.setBitmap(null);
      mScreenBitmap = ss;
    }

    // Optimizations
    mScreenBitmap.setHasAlpha(false);
    mScreenBitmap.prepareToDraw();

    // Start the post-screenshot animation
    startAnimation(
        finisher,
        mDisplayMetrics.widthPixels,
        mDisplayMetrics.heightPixels,
        statusBarVisible,
        navBarVisible);
  }
 private void setValueSummary(String preference, String property) {
   try {
     findPreference(preference)
         .setSummary(
             SystemProperties.get(
                 property, getResources().getString(R.string.device_info_default)));
   } catch (RuntimeException e) {
     // No recovery
   }
 }
 static {
   enabled = "1".equals(SystemProperties.get("persist.sampling_profiler"));
   if (enabled) {
     snapshotWriter = Executors.newSingleThreadExecutor();
     Log.i(TAG, "Profiler is enabled.");
   } else {
     snapshotWriter = null;
     Log.i(TAG, "Profiler is disabled.");
   }
 }
Пример #28
0
    GlRenderer(int glVersion, boolean translucent) {
      mGlVersion = glVersion;
      mTranslucent = translucent;

      String property;

      property = SystemProperties.get(DISABLE_VSYNC_PROPERTY, "false");
      mVsyncDisabled = "true".equalsIgnoreCase(property);
      if (mVsyncDisabled) {
        Log.d(LOG_TAG, "Disabling v-sync");
      }

      property = SystemProperties.get(PROFILE_PROPERTY, "false");
      mProfileEnabled = "true".equalsIgnoreCase(property);
      if (mProfileEnabled) {
        Log.d(LOG_TAG, "Profiling hardware renderer");
      }

      if (mProfileEnabled) {
        property =
            SystemProperties.get(PROFILE_MAXFRAMES_PROPERTY, Integer.toString(PROFILE_MAX_FRAMES));
        int maxProfileFrames = Integer.valueOf(property);
        mProfileData = new float[maxProfileFrames * PROFILE_FRAME_DATA_COUNT];
        for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) {
          mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1;
        }

        mProfileLock = new ReentrantLock();
      } else {
        mProfileData = null;
        mProfileLock = null;
      }

      property = SystemProperties.get(DEBUG_DIRTY_REGIONS_PROPERTY, "false");
      mDebugDirtyRegions = "true".equalsIgnoreCase(property);
      if (mDebugDirtyRegions) {
        Log.d(LOG_TAG, "Debugging dirty regions");
      }

      mShowOverdraw =
          SystemProperties.getBoolean(HardwareRenderer.DEBUG_SHOW_OVERDRAW_PROPERTY, false);
    }
 private final void restatDataDir() {
   try {
     mDataFileStats.restat(DATA_PATH);
     mFreeMem = (long) mDataFileStats.getAvailableBlocks() * mDataFileStats.getBlockSize();
   } catch (IllegalArgumentException e) {
     // use the old value of mFreeMem
   }
   // Allow freemem to be overridden by debug.freemem for testing
   String debugFreeMem = SystemProperties.get("debug.freemem");
   if (!"".equals(debugFreeMem)) {
     mFreeMem = Long.parseLong(debugFreeMem);
   }
   // Read the log interval from secure settings
   long freeMemLogInterval =
       Settings.Global.getLong(
               mContentResolver,
               Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
               DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES)
           * 60
           * 1000;
   // log the amount of free memory in event log
   long currTime = SystemClock.elapsedRealtime();
   if ((mLastReportedFreeMemTime == 0)
       || (currTime - mLastReportedFreeMemTime) >= freeMemLogInterval) {
     mLastReportedFreeMemTime = currTime;
     long mFreeSystem = -1, mFreeCache = -1;
     try {
       mSystemFileStats.restat(SYSTEM_PATH);
       mFreeSystem =
           (long) mSystemFileStats.getAvailableBlocks() * mSystemFileStats.getBlockSize();
     } catch (IllegalArgumentException e) {
       // ignore; report -1
     }
     try {
       mCacheFileStats.restat(CACHE_PATH);
       mFreeCache = (long) mCacheFileStats.getAvailableBlocks() * mCacheFileStats.getBlockSize();
     } catch (IllegalArgumentException e) {
       // ignore; report -1
     }
     EventLog.writeEvent(EventLogTags.FREE_STORAGE_LEFT, mFreeMem, mFreeSystem, mFreeCache);
   }
   // Read the reporting threshold from secure settings
   long threshold =
       Settings.Global.getLong(
           mContentResolver,
           Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
           DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD);
   // If mFree changed significantly log the new value
   long delta = mFreeMem - mLastReportedFreeMem;
   if (delta > threshold || delta < -threshold) {
     mLastReportedFreeMem = mFreeMem;
     EventLog.writeEvent(EventLogTags.FREE_STORAGE_CHANGED, mFreeMem);
   }
 }
 private boolean waitForState(String state) {
   // wait for the transition to complete.
   // give up after 1 second.
   for (int i = 0; i < 20; i++) {
     // State transition is done when sys.usb.state is set to the new configuration
     if (state.equals(SystemProperties.get("sys.usb.state"))) return true;
     SystemClock.sleep(50);
   }
   Slog.e(TAG, "waitForState(" + state + ") FAILED");
   return false;
 }