text:
package org.apache.spark.examples.ml;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
// $example on$
import org.apache.spark.ml.classification.BinaryLogisticRegressionSummary;
import org.apache.spark.ml.classification.LogisticRegression;
import org.apache.spark.ml.classification.LogisticRegressionModel;
import org.apache.spark.ml.classification.LogisticRegressionTrainingSummary;
import org.apache.spark.sql.DataFrame;
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.functions;
// $example off$

public class JavaLogisticRegressionSummaryExample {
  public static void main(String[] args) {
    SparkConf conf = new SparkConf().setAppName("JavaLogisticRegressionSummaryExample");
    JavaSparkContext jsc = new JavaSparkContext(conf);
    SQLContext sqlContext = new SQLContext(jsc);

    // Load training data
    DataFrame training = sqlContext.read().format("libsvm")
      .load("data/mllib/sample_libsvm_data.txt");

    LogisticRegression lr = new LogisticRegression()
      .setMaxIter(10)
      .setRegParam(0.3)
      .setElasticNetParam(0.8);

    // Fit the model
    LogisticRegressionModel lrModel = lr.fit(training);

    // $example on$
    // Extract the summary from the returned LogisticRegressionModel instance trained in the earlier
    // example
    LogisticRegressionTrainingSummary trainingSummary = lrModel.summary();

    // Obtain the loss per iteration.
    double[] objectiveHistory = trainingSummary.objectiveHistory();
    for (double lossPerIteration : objectiveHistory) {
      System.out.println(lossPerIteration);
    }

    // Obtain the metrics useful to judge performance on test data.
    // We cast the summary to a BinaryLogisticRegressionSummary since the problem is a binary
    // classification problem.
    BinaryLogisticRegressionSummary binarySummary =
      (BinaryLogisticRegressionSummary) trainingSummary;

    // Obtain the receiver-operating characteristic as a dataframe and areaUnderROC.
    DataFrame roc = binarySummary.roc();
    roc.show();
    roc.select("FPR").show();
    System.out.println(binarySummary.areaUnderROC());

    // Get the threshold corresponding to the maximum F-Measure and rerun LogisticRegression with
    // this selected threshold.
    DataFrame fMeasure = binarySummary.fMeasureByThreshold();
    double maxFMeasure = fMeasure.select(functions.max("F-Measure")).head().getDouble(0);
    double bestThreshold = fMeasure.where(fMeasure.col("F-Measure").equalTo(maxFMeasure))
      .select("threshold").head().getDouble(0);
    lrModel.setThreshold(bestThreshold);
    // $example off$

    jsc.stop();
  }
}


text:
/* Return true if the passed string is a valid US phone number.

The user may fill out the form field any way they choose as long as it is a valid US number. The following are examples of valid formats for US numbers (refer to the tests below for other variants):

555-555-5555
(555)555-5555
(555) 555-5555
555 555 5555
5555555555
1 555 555 5555

For this challenge you will be presented with a string such as 800-692-7753 or 8oo-six427676;laskdjf. Your job is to validate or reject the US phone number based on any combination of the formats provided above. The area code is required. If the country code is provided, you must confirm that the country code is 1. Return true if the string is a valid US phone number; otherwise return false. */

function telephoneCheck(str) {
  let filteredStr = str.match(/([0-9])/g);

  if(str.match(/\?/g) || str[0]==="-" || (str.match(/\)/g) && !str.match(/\(/g)) || (!str.match(/\)/g) && str.match(/\(/g))) {
    return false;
  } else if(filteredStr.length === 10 && filteredStr[0] === "5") {
    return true;
  } else if(filteredStr.length === 11 && filteredStr[0] === "1") {
    return true;
  } else {
    return false;
  }
}

telephoneCheck("1 555-555-5555");

redpajama_set_name: RedPajamaGithub


text:
import unittest
import sys
from setuptools import setup, Command

class RunTests(Command):
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    @staticmethod
    def run():
        loader = unittest.TestLoader()
        tests = loader.discover('test', pattern='*_test.py', top_level_dir='.')
        runner = unittest.TextTestRunner()
        results = runner.run(tests)
        sys.exit(0 if results.wasSuccessful() else 1)

setup(name='pyredux',
      version='0.1',
      description='Port of the Redux library for Python and for fun',
      url='http://github.com/rikbruil/pyredux',
      author='Rik Bruil',
      author_email='rik.bruil@gmail.com',
      license='MIT',
      packages=['pyredux'],
      install_requires=[
          # 'markdown',
      ],
      zip_safe=False,
      cmdclass={'test': RunTests},)


text:
mxArray* permuteArray(mxArray* temp_array, int n_dimensions){

    //Ideally this would be avoided since it is only called to change from
    //column-major to row-major ordering

    //Note, we pass in the # of dimensions since mxGetNumberOfDimensions
    //truncates all trailing 1d dimensions, i.e. so if we have an array
    //of size [3,1,1,1] it would get permuted to [1,3] and not [1,1,1,3]

    //int n_dimensions = mxGetNumberOfDimensions(temp_array);

    mxArray* second_dims = mxCreateNumericMatrix(1,n_dimensions,mxDOUBLE_CLASS,0);
    double* output_array_dims = mxGetData(second_dims);

    for (int i = 0; i < n_dimensions; i++){
        //
        //  Example for 3d array
        //  0, 1, 2 - output index
        //  3, 2, 1 - value
        //
        //  0 = 3 - 0 = 3
        //  1 = 3 - 1 = 2
        //  2 = 3 - 2 = 1
        output_array_dims[i] = n_dimensions - i;
    }

    //B = permute(A,ORDER)
    //int mexCallMATLAB(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[], const char *functionName);
    //
    //  plhs    = output
    //  prhs[0] = input_array;
    //  prhs[1] = order

    mxArray* plhs;
    mxArray* prhs[2];
    prhs[0] = temp_array;
    prhs[1] = second_dims;

    mexCallMATLAB(1,&plhs, 2, prhs, "permute");

    return plhs;
}

void populate_dims__row_major(mwSize *dims, int *d1,
        int *child_count_array, int array_data_index,
        int array_md_index, int n_dimensions){
    //
    //  row-major ordering - i.e. highest dimension changes quickest
    //
    //  e.g. [[5,4],[2,3],[7,8]] -> size => [3,2]
    //
    //  5 4
    //  2 3
    //  7 8

    dims[0] = child_count_array[array_data_index];
    for (int iDim = 1; iDim < n_dimensions; iDim++){
        array_data_index = d1[++array_md_index];
        dims[iDim] = child_count_array[array_data_index];
    }
}

void populate_dims__column_major(mwSize *dims, int *d1,
        int *child_count_array, int array_data_index,
        int array_md_index, int n_dimensions){
    //
    //  column-major ordering - i.e. low dimension changes quickest
    //
    //  e.g. [[5,4],[2,3],[7,8]] -> size => [2,3]
    //
    //  5 2 7
    //  4 3 8

    dims[n_dimensions-1] = child_count_array[array_data_index];

    for (int iDim = n_dimensions-2; iDim >= 0; iDim--){
        array_data_index = d1[++array_md_index];
        dims[iDim] = child_count_array[array_data_index];
    }
}
//=========================================================================
//---------------------   Empty Array Parsing  ----------------------------
//=========================================================================
mxArray* parse_empty_numeric_array(mwSize *dims, int array_size){

    if (array_size > MAX_ARRAY_DIMS){
        mexErrMsgIdAndTxt("turtle_json:max_nd_array_depth",
                "The maximum nd array depth depth was exceeded");
    }

    for (int iDim = 0; iDim < array_size; iDim++){
        dims[iDim] = 0;
    }

    return mxCreateNumericArray(array_size,dims,mxDOUBLE_CLASS,0);
}

//=========================================================================
//=========================================================================
//---------------       Numerical Array Parsing         -------------------
//=========================================================================
mxArray* parse_1d_numeric_array_row_major(int *d1, double *numeric_data,
        int array_size, int array_md_index){

    int first_numeric_md_index = array_md_index + 1;
    int first_numeric_data_index = d1[first_numeric_md_index];

    mxArray *output = mxCreateNumericMatrix(1,0,mxDOUBLE_CLASS,0);

    double *temp_value = mxMalloc(array_size*sizeof(double));
    memcpy(temp_value,&numeric_data[first_numeric_data_index],array_size*sizeof(double));
    mxSetData(output,temp_value);
	mxSetN(output,array_size);

    return output;
}

mxArray* parse_1d_numeric_array_column_major(int *d1, double *numeric_data,
        int array_size, int array_md_index){

    int first_numeric_md_index = array_md_index + 1;
    int first_numeric_data_index = d1[first_numeric_md_index];

    mxArray *output = mxCreateNumericMatrix(0,1,mxDOUBLE_CLASS,0);

    double *temp_value = mxMalloc(array_size*sizeof(double));
    memcpy(temp_value,&numeric_data[first_numeric_data_index],array_size*sizeof(double));
    mxSetData(output,temp_value);
	mxSetM(output,array_size);

    return output;
}

mxArray* parse_nd_numeric_array_column_major(int *d1, mwSize *dims,
        int *child_count_array, double *numeric_data, int array_md_index,
        uint8_t *array_depths, int *next_sibling_index_array){

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    //TODO: We could avoid this check if we allocated 'dims' based on the max
    //TODO: Alternatively, we could allocate this permanently for mex
    //and recycle between mex calls

    if (array_depth > MAX_ARRAY_DIMS){
        mexErrMsgIdAndTxt("turtle_json:max_nd_array_depth",
                "The maximum nd array depth depth was exceeded");
    }

    //The -1 is for previous value before the next sibling
    // "my_data": [[1,2],[3,4],[5,6]], "next_data": ...
    //            s                    n   (s start, n next)
    //                            ^ => (n - 1)
    int last_numeric_md_index  = next_sibling_index_array[array_data_index]-1;
    //
    // [ [ [ 23, 15 ], [ ...
    // s
    // 0 1 2 3  <= indices
    // 3 2 1    <= array depths
    //       ^ => (s + array_depth[s])
    int first_numeric_md_index = array_md_index + array_depth;
    int first_numeric_data_index = d1[first_numeric_md_index];

    int n_numbers = d1[last_numeric_md_index] - first_numeric_data_index + 1;

    double *data = mxMalloc(n_numbers*sizeof(double));
    memcpy(data,&numeric_data[first_numeric_data_index],n_numbers*sizeof(double));

    populate_dims__column_major(dims, d1, child_count_array, array_data_index, array_md_index, array_depth);

    mxArray *output = mxCreateNumericArray(0,0,mxDOUBLE_CLASS,0);
    mxSetData(output,data);
    mxSetDimensions(output,dims,array_depth);
    return output;
}

mxArray* parse_nd_numeric_array_row_major(int *d1, mwSize *dims,
        int *child_count_array, double *numeric_data, int array_md_index,
        uint8_t *array_depths, int *next_sibling_index_array){

	mxArray* temp_array = parse_nd_numeric_array_column_major(d1,
            dims, child_count_array, numeric_data, array_md_index,
            array_depths, next_sibling_index_array);

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    return permuteArray(temp_array, array_depth);

}

//Old version, may incorporate into new version eventually ...

// // // mxArray* parse_nd_numeric_array_row_major(int *d1, mwSize *dims,
// // //         int *child_count_array, double *numeric_data, int array_md_index,
// // //         uint8_t *array_depths, int *next_sibling_index_array){
// // //
// // //     int array_data_index = d1[array_md_index];
// // //     int array_depth = array_depths[array_data_index];
// // //
// // //     //TODO: We could avoid the check below if we allocated 'dims' based on the max
// // //     //TODO: Alternatively, we could allocate this permanently for mex
// // //     //and recycle between mex calls - I think this is the better option ...
// // //
// // //     if (array_depth > MAX_ARRAY_DIMS){
// // //         mexErrMsgIdAndTxt("turtle_json:max_nd_array_depth","The maximum nd array depth depth was exceeded");
// // //     }
// // //
// // //     //The -1 is for previous value before the next sibling
// // //     // "my_data": [[1,2],[3,4],[5,6]], "next_data": ...
// // //     //            s                    n   (s start, n next)
// // //     //                            ^ => (n - 1)
// // //     int last_numeric_md_index  = next_sibling_index_array[array_data_index] - 1;
// // //     //
// // //     // [ [ [ 23, 15 ], [ ...
// // //     // s
// // //     // 0 1 2 3  <= indices
// // //     // 3 2 1    <= array depths
// // //     //       ^ => (s + array_depth[s])
// // //     int first_numeric_md_index = array_md_index + array_depth;
// // //     int first_numeric_data_index = d1[first_numeric_md_index];
// // //
// // //     int n_numbers = d1[last_numeric_md_index] - first_numeric_data_index + 1;
// // //
// // //     double *data = mxMalloc(n_numbers*sizeof(double));
// // //     double *data_start = data;
// // //
// // //     populate_dims__row_major(dims, d1, child_count_array, array_data_index, array_md_index, array_depth);
// // //
// // //     int n_rows;
// // //     int n_columns;
// // //     int n_pages;
// // //
// // //     double *source_data = &numeric_data[first_numeric_data_index];
// // //     //Looping offsets
// // //     // - let's say we have an array of size [5 7 6]
// // //     switch (array_depth) {
// // //         case 0:
// // //             mexErrMsgIdAndTxt("turtle_json:code_error","0d numeric array not supported for nd-array");
// // //             break;
// // //         case 1:
// // //             mexErrMsgIdAndTxt("turtle_json:code_error","1d numeric array not supported for nd-array");
// // //             break;
// // //         case 2:
// // //             n_rows = dims[0];
// // //             n_columns = dims[1];
// // //             for (int col = 0; col < n_columns; col++){
// // //                 for (int row = 0; row < n_rows; row++){
// // //                     *data = source_data[col + row*n_columns];
// // //                     data++;
// // //                 }
// // //             }
// // //             break;
// // //         case 3:
// // //             n_rows = dims[0];
// // //             n_columns = dims[1];
// // //             n_pages = dims[2];
// // //             for (int page = 0; page < n_pages; page++){
// // //                 for (int col = 0; col < n_columns; col++){
// // //                     for (int row = 0; row < n_rows; row++){
// // //                         *data = source_data[page + col*n_pages + row*n_columns*n_pages];
// // //                         data++;
// // //                     }
// // //                 }
// // //             }
// // //             break;
// // //         default:
// // //             //   permuted_data = permute(data,reversed_dims)
// // //             //
// // //             //int mexCallMATLAB(int nlhs, mxArray *plhs[], int nrhs,
// // //             //              mxArray *prhs[], const char *functionName);
// // //             mexErrMsgIdAndTxt("turtle_json:code_error","greater than 3d array not yet handled");
// // //     }
// // //
// // //     mxArray *output = mxCreateNumericArray(0,0,mxDOUBLE_CLASS,0);
// // //     mxSetData(output,data_start);
// // //     mxSetDimensions(output,dims,array_depth);
// // //     return output;
// // // }

//---------------     Logical Array Parsing        -------------------
//=========================================================================
mxArray* parse_1d_logical_array_row_major(int *d1, uint8_t *types,
        int array_size, int array_md_index){

    int md_index = array_md_index + 1;

    uint8_t *data = mxMalloc(array_size*sizeof(uint8_t));
    for (int iElem = 0; iElem < array_size; iElem++){
        data[iElem] = types[md_index] == TYPE_TRUE;
        md_index++;
    }

    mxArray *output = mxCreateLogicalMatrix(1,0);
    mxSetData(output,data);
    mxSetN(output,array_size);
    return output;
}

mxArray* parse_1d_logical_array_column_major(int *d1, uint8_t *types,
        int array_size, int array_md_index){

    int md_index = array_md_index + 1;

    uint8_t *data = mxMalloc(array_size*sizeof(uint8_t));

    for (int iElem = 0; iElem < array_size; iElem++){
        data[iElem] = types[md_index] == TYPE_TRUE;
        md_index++;
    }

    mxArray *output = mxCreateLogicalMatrix(0,1);
    mxSetData(output,data);
    mxSetM(output,array_size);
    return output;
}

mxArray* parse_nd_logical_array_column_major(int *d1, uint8_t *types, mwSize *dims,
        int *child_count_array, int array_md_index, uint8_t *array_depths,
        int *next_sibling_index_array){

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    populate_dims__column_major(dims, d1, child_count_array, array_data_index, array_md_index, array_depth);

    //See explanation in parse_nd_numeric_array
    int last_logical_md_index  = next_sibling_index_array[array_data_index]-1;
    int first_logical_md_index = array_md_index + array_depth;
    int first_logical_count = d1[first_logical_md_index];
    int last_logical_count = d1[last_logical_md_index];

    int n_values = last_logical_count - first_logical_count + 1;

    uint8_t *data = mxMalloc(n_values*sizeof(uint8_t));

    int iData = 0;
    for (int iType = first_logical_md_index; iType <= last_logical_md_index; iType++){
        if (types[iType] != TYPE_ARRAY){
            data[iData] = types[iType] == TYPE_TRUE;
            iData++;
        }
    }

    mxArray *output = mxCreateLogicalArray(0,0);
    mxSetData(output,data);
    mxSetDimensions(output,dims,array_depth);
    return output;
}

mxArray* parse_nd_logical_array_row_major(int *d1, uint8_t *types, mwSize *dims,
        int *child_count_array, int array_md_index, uint8_t *array_depths,
        int *next_sibling_index_array){

    mxArray* temp_array = parse_nd_logical_array_column_major(d1, types,
            dims, child_count_array, array_md_index, array_depths,
            next_sibling_index_array);

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    return permuteArray(temp_array, array_depth);
}

//---------------     String Array Parsing        -------------------
//=========================================================================
mxArray* parse_1d_string_array_column_major(int *d1, int array_size, int array_md_index, mxArray *strings){
    mxArray *output = mxCreateCellMatrix(array_size,1);
    int string_md_index = array_md_index + 1;
    int string_data_index = d1[string_md_index];
    for (int iData = 0; iData < array_size; iData++){
        mxSetCell(output, iData, mxCreateReference(mxGetCell(strings,string_data_index)));
        string_data_index++;
    }
    return output;
}

mxArray* parse_1d_string_array_row_major(int *d1, int array_size, int array_md_index, mxArray *strings){
    mxArray *output = mxCreateCellMatrix(1,array_size);
    int string_md_index = array_md_index + 1;
    int string_data_index = d1[string_md_index];
    for (int iData = 0; iData < array_size; iData++){
        mxSetCell(output, iData, mxCreateReference(mxGetCell(strings,string_data_index)));
        string_data_index++;
    }
    return output;
}

mxArray* parse_nd_string_array_column_major(int *d1, mwSize *dims,
        int *child_count_array, int array_md_index, uint8_t *array_depths,
        int *next_sibling_index_array, mxArray *strings){

    //[["a","b"],["c","d"]]

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    populate_dims__column_major(dims, d1, child_count_array, array_data_index, array_md_index, array_depth);

    //See explanation in parse_nd_numeric_array
    int last_string_md_index  = next_sibling_index_array[array_data_index]-1;
    int first_string_md_index = array_md_index + array_depth;
    int first_string_data_index = d1[first_string_md_index];

    int n_strings = d1[last_string_md_index] - first_string_data_index + 1;

    //mexPrintf("n_strings: %d\n",n_strings);

    mxArray *output = mxCreateCellArray(array_depth,dims);
    int string_data_index = first_string_data_index;
    for (int iString = 0; iString < n_strings; iString++){
        mxSetCell(output,iString,mxCreateReference(mxGetCell(strings,string_data_index)));
        string_data_index++;
    }
    return output;
}

mxArray* parse_nd_string_array_row_major(int *d1, mwSize *dims,
        int *child_count_array, int array_md_index, uint8_t *array_depths,
        int *next_sibling_index_array, mxArray *strings){

    //This doesn't work if we lose dimensions due to collapsing
    //i.e. if we have the following as column major for size
    //[9,1,1,1]
    //In Matlab once created we only have [9,1]
    //Which then gets permuted to be [1,9]

    mxArray* temp_array = parse_nd_string_array_column_major(d1, dims,
        child_count_array, array_md_index, array_depths,
        next_sibling_index_array, strings);

    int array_data_index = d1[array_md_index];
    int array_depth = array_depths[array_data_index];

    return permuteArray(temp_array, array_depth);
}

//=========================================================================
//=========================================================================
//=========================================================================
mxArray *parse_array(Data data, int md_index){
    //
    //  This code handles parsing of a heterogenous array. It doesn't
    //  actual
    //
    //  See Also
    //  --------
    //  parse_non_homogenous_array
    //  parse_1d_array_column_major
    //  parse_cellstr
    //  parse_logical_array
    //  parse_nd_numeric_array
    //  parse_nd_string_array
    //  parse_logical_nd_array

    int cur_array_data_index = data.d1[md_index];
    mxArray *output;

    int temp_count;
    int temp_data_index;
    int temp_md_index;
    //int temp_array_depth;
    //mwSize *dims;
    double *temp_value;

    mxArray *temp_obj;

//     mexPrintf("md_index: %d\n",md_index);
//     mexPrintf("data_index: %d\n",cur_array_data_index);
//     mexPrintf("Type: %d\n",data.array_types[cur_array_data_index]);
    //return output;

    switch (data.array_types[cur_array_data_index]){
        case ARRAY_OTHER_TYPE:
            //  [1,false,"apples"]
            output = parse_non_homogenous_array(data, cur_array_data_index, md_index);
            break;
        case ARRAY_NUMERIC_TYPE:
            //  [1,2,3,4]
            output = parse_1d_numeric_array_column_major(data.d1,data.numeric_data,
                    data.child_count_array[cur_array_data_index],md_index);
            break;
        case ARRAY_STRING_TYPE:
            //  ['cheese','crow']
            output = parse_1d_string_array_column_major(data.d1,
                    data.child_count_array[cur_array_data_index],
                    md_index,data.strings);
            break;
        case ARRAY_LOGICAL_TYPE:
            //  [true, false, true]
            output = parse_1d_logical_array_column_major(data.d1, data.types,
                    data.child_count_array[cur_array_data_index], md_index);
            break;
        case ARRAY_OBJECT_SAME_TYPE:
            //  [{'a':1,'b':2},{'a':3,'b':4}]
            temp_md_index = md_index + 1;
            temp_data_index = data.d1[temp_md_index];
            temp_count = data.child_count_array[cur_array_data_index];
            output = get_initialized_struct(data,temp_data_index,temp_count);
            for (int iObj = 0; iObj < temp_count; iObj++){
                parse_object(data, output, iObj, temp_md_index);
                temp_md_index = data.next_sibling_index_object[temp_data_index];
                temp_data_index = data.d1[temp_md_index];
            }
            break;
        case ARRAY_OBJECT_DIFF_TYPE:
            //  [{'a':1,'b':2},{'c':3,'a':4}]
            temp_count = data.child_count_array[cur_array_data_index];
            output = mxCreateCellMatrix(1,temp_count);
            temp_md_index = md_index + 1;
            for (int iData = 0; iData < temp_count; iData++){
                temp_data_index = data.d1[temp_md_index];
                temp_obj = get_initialized_struct(data,temp_data_index,1);
                parse_object(data, temp_obj, 0, temp_md_index);
                mxSetCell(output,iData,temp_obj);
                temp_md_index = data.next_sibling_index_object[temp_data_index];
            }
            break;
        case ARRAY_ND_NUMERIC:
            output = parse_nd_numeric_array_column_major(data.d1, data.dims,
                    data.child_count_array, data.numeric_data, md_index,
                    data.array_depths, data.next_sibling_index_array);
            break;
        case ARRAY_ND_STRING:
            output = parse_nd_string_array_column_major(data.d1, data.dims,
                        data.child_count_array, md_index, data.array_depths,
                        data.next_sibling_index_array, data.strings);
            break;
        case ARRAY_ND_LOGICAL:
            output = parse_nd_logical_array_column_major(data.d1, data.types, data.dims,
                    data.child_count_array, md_index, data.array_depths,
                    data.next_sibling_index_array);
            break;
        case ARRAY_EMPTY_TYPE:
        case ARRAY_ND_EMPTY:
            output = parse_empty_numeric_array(data.dims, data.child_count_array[cur_array_data_index]);
            break;

    }
    return output;
}
//=========================================================================
//=========================================================================
mxArray *parse_array_with_options(Data data, int md_index,
        FullParseOptions *options){
    //
    //  This code handles parsing of a heterogenous array. It doesn't
    //  actual
    //
    //  See Also
    //  --------
    //  parse_non_homogenous_array
    //  parse_1d_array
    //  parse_cellstr
    //  parse_logical_array
    //  parse_nd_numeric_array
    //  parse_nd_string_array
    //  parse_logical_nd_array

    int cur_array_data_index = data.d1[md_index];
    mxArray *output;

    bool collapse_objects;

    int n_dimensions;
    int temp_count;
    int temp_data_index;
    int temp_md_index;
    int temp_array_depth;
    mwSize *dims;
    double *temp_value;
    uint8_t *types;

    mxArray *temp_obj;

    //mexPrintf("type: %d\n",data.array_types[cur_array_data_index]);

    switch (data.array_types[cur_array_data_index]){
        case ARRAY_OTHER_TYPE:
            //  [1,false,"apples"]
            output = parse_non_homogenous_array_with_options(data, cur_array_data_index, md_index, options);
            break;
        case ARRAY_NUMERIC_TYPE:
            //  [1,2,3,4]
            n_dimensions = data.array_depths[cur_array_data_index];
            if (options->max_numeric_collapse_depth == -1 || options->max_numeric_collapse_depth >= n_dimensions){
                if (options->column_major){
                    output = parse_1d_numeric_array_column_major(data.d1,data.numeric_data,
                                data.child_count_array[cur_array_data_index],md_index);
                }else{
                    output = parse_1d_numeric_array_row_major(data.d1,data.numeric_data,
                                data.child_count_array[cur_array_data_index],md_index);
                }
            }else{
                temp_count = data.child_count_array[cur_array_data_index];
                output = mxCreateCellMatrix(1,temp_count);

                temp_md_index = md_index + 1;
                temp_data_index = data.d1[temp_md_index];
                temp_value = &(data.numeric_data[temp_data_index]);
                //Note, since we have a homogenous array we don't need
                //to go back to the md_index, we can just increment ...
                for (int iData = 0; iData < temp_count; iData++){
                    temp_obj = mxCreateDoubleScalar(*temp_value);
                    mxSetCell(output,iData,temp_obj);
                    temp_value++;
                }
            }
            break;
        case ARRAY_STRING_TYPE:
            //  ['cheese','crow']
            //  Note that not collapsing here doesn't make any sense
            // as all elements go in a cell regardless of options
            output = parse_1d_string_array_column_major(data.d1,
                    data.child_count_array[cur_array_data_index],
                    md_index,data.strings);
            break;
        case ARRAY_LOGICAL_TYPE:
            n_dimensions = data.array_depths[cur_array_data_index];
            if (options->max_bool_collapse_depth == -1 || options->max_bool_collapse_depth >= n_dimensions){
                if (options->column_major){
                    output = parse_1d_logical_array_column_major(data.d1, data.types,
                            data.child_count_array[cur_array_data_index], md_index);
                }else{
                    output = parse_1d_logical_array_row_major(data.d1, data.types,
                            data.child_count_array[cur_array_data_index], md_index);
                }
            }else{
                temp_count = data.child_count_array[cur_array_data_index];
                output = mxCreateCellMatrix(1,temp_count);

                temp_md_index = md_index + 1;
                types = &(data.types[temp_md_index]);
                for (int iData = 0; iData < temp_count; iData++){
                    temp_obj = mxCreateLogicalScalar(*types == TYPE_TRUE);
                    mxSetCell(output,iData,temp_obj);
                    types++;
                }
            }

//             //  [true, false, true]
//             output = parse_1d_logical_array_column_major(data.d1, data.types,
//                     data.child_count_array[cur_array_data_index], md_index);
            break;
        case ARRAY_OBJECT_SAME_TYPE:
        case ARRAY_OBJECT_DIFF_TYPE:
            collapse_objects = options->collapse_objects &&
                    ARRAY_OBJECT_SAME_TYPE == data.array_types[cur_array_data_index];

            temp_md_index = md_index + 1;
            temp_count = data.child_count_array[cur_array_data_index];

            if (collapse_objects){
                //In this case the output is a structure array
                temp_data_index = data.d1[temp_md_index];
                output = get_initialized_struct(data,temp_data_index,temp_count);
                for (int iObj = 0; iObj < temp_count; iObj++){
                    parse_object_with_options(data, output, iObj, temp_md_index, options);
                    temp_md_index = data.next_sibling_index_object[temp_data_index];
                    temp_data_index = data.d1[temp_md_index];
                }

            }else{
                //In this case the output is a cell array
                output = mxCreateCellMatrix(1,temp_count);
                for (int iData = 0; iData < temp_count; iData++){
                    temp_data_index = data.d1[temp_md_index];
                    temp_obj = get_initialized_struct(data,temp_data_index,1);
                    parse_object_with_options(data, temp_obj, 0, temp_md_index, options);
                    mxSetCell(output,iData,temp_obj);
                    temp_md_index = data.next_sibling_index_object[temp_data_index];
                }
            }
            break;
        case ARRAY_ND_NUMERIC:
            n_dimensions = data.array_depths[cur_array_data_index];
            //mexPrintf("option: %d\n",options->max_numeric_collapse_depth);
            //mexPrintf("n_dimensions: %d\n",n_dimensions);

            if (options->max_numeric_collapse_depth == -1 || options->max_numeric_collapse_depth >= n_dimensions){
                if (options->column_major){
                    output = parse_nd_numeric_array_column_major(data.d1, data.dims,
                            data.child_count_array, data.numeric_data, md_index,
                            data.array_depths, data.next_sibling_index_array);
                }else{
                    output = parse_nd_numeric_array_row_major(data.d1, data.dims,
                        data.child_count_array, data.numeric_data, md_index,
                        data.array_depths, data.next_sibling_index_array);
                }
            }else{
                //Options specify not to collapse, so instead we
                //loop over each sub-array and parse it, populating
                //this array as a cell array
                temp_count = data.child_count_array[cur_array_data_index];

                //Should this be many rows or columns? Leaving as rows
                //for now ...
                //
                //We might want a 1d array shape preference ...
                output = mxCreateCellMatrix(1,temp_count);
                temp_md_index = md_index + 1;
                for (int iData = 0; iData < temp_count; iData++){
                    temp_data_index = data.d1[temp_md_index];
                    temp_obj = parse_array_with_options(data, temp_md_index, options);
                    mxSetCell(output,iData,temp_obj);
                    temp_md_index = data.next_sibling_index_array[temp_data_index];
                }
            }
            break;
        case ARRAY_ND_STRING:
            n_dimensions = data.array_depths[cur_array_data_index];

          	if (options->max_string_collapse_depth == -1 || options->max_string_collapse_depth >= n_dimensions){
                if (options->column_major){
                    output = parse_nd_string_array_column_major(data.d1, data.dims,
                        data.child_count_array, md_index, data.array_depths,
                        data.next_sibling_index_array, data.strings);
                }else{
                    output = parse_nd_string_array_row_major(data.d1, data.dims,
                        data.child_count_array, md_index, data.array_depths,
                        data.next_sibling_index_array, data.strings);
                }
            }else{
                //Options specify not to collapse, so instead we
                //loop over each sub-array and parse it, populating
                //this array as a cell array

                //TODO: Ideally this should be a function since it is shared
                //by number and bool
                temp_count = data.child_count_array[cur_array_data_index];
                output = mxCreateCellMatrix(1,temp_count);
                temp_md_index = md_index + 1;
                for (int iData = 0; iData < temp_count; iData++){
                    temp_data_index = data.d1[temp_md_index];
                    temp_obj = parse_array_with_options(data, temp_md_index, options);
                    mxSetCell(output,iData,temp_obj);
                    temp_md_index = data.next_sibling_index_array[temp_data_index];
                }
            }
            break;
        case ARRAY_ND_LOGICAL:
          	n_dimensions = data.array_depths[cur_array_data_index];

          	if (options->max_bool_collapse_depth == -1 || options->max_bool_collapse_depth >= n_dimensions){
                if (options->column_major){
                    output = parse_nd_logical_array_column_major(data.d1, data.types, data.dims,
                        data.child_count_array, md_index, data.array_depths,
                        data.next_sibling_index_array);
                }else{
                    output = parse_nd_logical_array_row_major(data.d1, data.types, data.dims,
                        data.child_count_array, md_index, data.array_depths,
                        data.next_sibling_index_array);
                }
            }else{
                //Options specify not to collapse, so instead we
                //loop over each sub-array and parse it, populating
                //this array as a cell array

                //TODO: Ideally this should be a function since it is shared
                //by number and string
                temp_count = data.child_count_array[cur_array_data_index];
                output = mxCreateCellMatrix(1,temp_count);
                temp_md_index = md_index + 1;
                for (int iData = 0; iData < temp_count; iData++){
                    temp_data_index = data.d1[temp_md_index];
                    temp_obj = parse_array_with_options(data, temp_md_index, options);
                    mxSetCell(output,iData,temp_obj);
                    temp_md_index = data.next_sibling_index_array[temp_data_index];
                }
            }
            break;
        case ARRAY_EMPTY_TYPE:
        case ARRAY_ND_EMPTY:
            output = parse_empty_numeric_array(data.dims, data.child_count_array[cur_array_data_index]);
            break;

    }
    return output;
} //end parse_array_with_options()
//=========================================================================
//=========================================================================
mxArray* parse_non_homogenous_array(Data data, int array_data_index, int array_md_index){

    //This is the "messiest" array option of all. Since we need to go through item
    //by item and parse the result ...
    int array_size = data.child_count_array[array_data_index];
    mxArray* output = mxCreateCellMatrix(1,array_size);

    int current_md_index = array_md_index + 1;
    int current_data_index;
    for (int iData = 0; iData < array_size; iData++){
        switch (data.types[current_md_index]){
            case TYPE_OBJECT:
                current_data_index = data.d1[current_md_index];
                mxArray* temp_obj = get_initialized_struct(data,current_data_index,1);
                parse_object(data, temp_obj, 0, current_md_index);
                mxSetCell(output,iData,temp_obj);
                current_md_index = data.next_sibling_index_object[current_data_index];
                break;
            case TYPE_ARRAY:
                current_data_index = data.d1[current_md_index];
                mxSetCell(output, iData, parse_array(data,current_md_index));
                current_md_index = data.next_sibling_index_array[current_data_index];
                break;
            case TYPE_KEY:
                mexErrMsgIdAndTxt("turtle_json:code_error",
                        "Found key type as child of array");
                break;
            case TYPE_STRING:
                mxSetCell(output, iData, getString(data.d1,data.strings,current_md_index));
                current_md_index++;
                break;
            case TYPE_NUMBER:
                mxSetCell(output, iData, getNumber(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_NULL:
                mxSetCell(output, iData, getNull(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_TRUE:
                mxSetCell(output, iData, getTrue(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_FALSE:
                mxSetCell(output, iData, getFalse(data,current_md_index));
                current_md_index++;
                break;
        }
    }
    return output;
}

mxArray* parse_non_homogenous_array_with_options(Data data, int array_data_index,
        int array_md_index, FullParseOptions *options){

    //This is the "messiest" array option of all. Since we need to go through item
    //by item and parse the result ...
    int array_size = data.child_count_array[array_data_index];
    mxArray* output = mxCreateCellMatrix(1,array_size);

    //[1,"test",{"cheese":3}]

    int current_md_index = array_md_index + 1;
    int current_data_index;
    for (int iData = 0; iData < array_size; iData++){
        switch (data.types[current_md_index]){
            case TYPE_OBJECT:
                current_data_index = data.d1[current_md_index];
                mxArray* temp_obj = get_initialized_struct(data,current_data_index,1);
                //Currently no options for an object
                parse_object(data, temp_obj, 0, current_md_index);
                mxSetCell(output,iData,temp_obj);
                current_md_index = data.next_sibling_index_object[current_data_index];
                break;
            case TYPE_ARRAY:
                current_data_index = data.d1[current_md_index];
                mxSetCell(output, iData,
                        parse_array_with_options(data,current_md_index,options));
                current_md_index = data.next_sibling_index_array[current_data_index];
                break;
            case TYPE_KEY:
                mexErrMsgIdAndTxt("turtle_json:code_error",
                        "Found key type as child of array");
                break;
            case TYPE_STRING:
                mxSetCell(output, iData, getString(data.d1,data.strings,current_md_index));
                current_md_index++;
                break;
            case TYPE_NUMBER:
                mxSetCell(output, iData, getNumber(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_NULL:
                mxSetCell(output, iData, getNull(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_TRUE:
                mxSetCell(output, iData, getTrue(data,current_md_index));
                current_md_index++;
                break;
            case TYPE_FALSE:
                mxSetCell(output, iData, getFalse(data,current_md_index));
                current_md_index++;
                break;
        }
    }
    return output;
}


text:
% ---------------------------------------------------------------------------- %
\subsection{Das R\"ontgen-Spektrum}
\label{subsec:rontgenSpektrum}
% ---------------------------------------------------------------------------- %

\begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\textwidth]{images/rontgen-rohre.png}
    \caption{%
        R\"ontgen-R\"ohre,  schematisch. Gl\"uhkathode  K:  orange,  Anode  A:
        blau. \emph{Quelle}: Versuchsanleitung
    }
    \label{fig:rontgenRohre}
\end{figure}

R\"ontgen-Strahlung   entsteht    stets,   wenn   schnelle    Elektronen   auf
Materie  treffen,  z.B.  in   einem  Monitor  mit  Kathodenstrahl-R\"ohre. Sie
besteht   aus   einer   Gl\"uhkathode    \textbf{K}   (orange   in   Abbildung
\ref{fig:rontgenRohre})  und   einer  Anode  \textbf{A}  (blau   in  Abbildung
\ref{fig:rontgenRohre}). Eingeschlossen  ist das  Ganze in  einem vakuumierten
Glaskolben.

Die  Kathode  gibt  durch  ihre  Erhitzung Elektronen  ab,  welche  durch  das
Elektrische  Feld  zwischen  Kathode  und Anode  auf  die  Anode  beschleunigt
werden   (Spannung  zwischen   Kathode  und   Anode:  \"ublicherweise   einige
\SI{10}{\kilo\volt} bis  einige \SI{100}{\kilo\volt}, in diesem  Versuch liegt
sie  zwischen \SI{12}{\kilo\volt}  und \SI{35}{\kilo\volt}).   Beim Auftreffen
auf die Anode haben die Elektronen somit eine Energie von $E_k = e \cdot U$.

In der Anode  wird nun ein kleiner Teil (weniger  als \SI{1}{\percent}) dieser
Energie in R\"ontgenstrahlung  umgewandelt (der Rest geht in  die Anregung und
Ionisation der Metallatome der Anode).

Da  die abgegebene  R\"ontgenstrahlung  einigermassen isotrop  ist, wird  eine
Abschirmung  ben\"otigt, um  nicht  ziellos die  Umgebung zu  verstrahlen. Der
R\"ontgenstrahl wird weiter auf eine  nutzbar kleine Form reduziert, indem man
einen Bleikollimator benutzt.

Als  Anodenmaterial wird  normalerweise  ein Metall  mit  mittlerer bis  hoher
Ordnungszahl verwendet. In diesem Versuch kommen  Kupfer ($Z = 29$), Eisen ($Z
= 26$) und Molybd\"an ($Z = 42$) zum Einsatz.

\clearpage
Das R\"ontgen-Spektrum selbst besteht aus zwei Komponenten:
\begin{itemize}
    \item
        \textbf{Bremskontinuum:}    unspezifische   Form,    Einsatzpunkt   am
        kurzwelligen Ende ($\lambda_G$ in Abbildung \ref{fig:rontgenSpektrum})
        ist abh\"angig von der R\"ohrenspannung.
    \item
        \textbf{R\"ontgenlinien:}  diskrete,  vom  Anodenmaterial  abh\"angige
        Strahlung, unabh\"angig von der Spannung
\end{itemize}

\begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\textwidth]{images/rontgen-spektrum.png}
    \caption{%
        R\"ontgen-Spektrum. \emph{Quelle}: Versuchsanleitung
    }
    \label{fig:rontgenSpektrum}
\end{figure}

% ---------------------------------------------------------------------------- %
\subsubsection{Die Bremsstrahlung}
\label{subsubsec:bremsstrahlung}
% ---------------------------------------------------------------------------- %

Dringt ein Elektron von der Kathode in ein Atom der Anode ein und kommt in den
Einflussbereich des Coulomb-Feldes des Kerns, wird gem\"ass Quantentheorie ein
Photon $\gamma$ abgegeben.

Die Grenze der  k\"urzesten Wellenl\"ange $\lambda_G$, die  im Spektrum dieser
Photonen auftritt, beschreibt  die Situation, wenn ein  emittiertes Photon die
gesamte Energie eines einfallenden  Elektrons aufgenommen hat (zur Erinnerung:
k\"urzere  Wellenl\"ange  korrespondiert  mit  h\"oherer  Frequenz  und  somit
h\"oherer Energie eines  Photons). Da es unm\"oglich ist, mehr  Energie in ein
Photon zu transferieren,  als das einfallende Elektron  mitbringt, reisst dort
das Spektrum am linken Ende ab.

Die  maximale  Energie,  die  ein  emittiertes  R\"ontgen-Photon  haben  kann,
berechnet sich somit zu

\begin{equation}
    \label{eq:E_gamma_max}
    E_{\gamma,max} = e \cdot U
\end{equation}

mit der zugeh\"origen Wellenl\"ange:

\begin{equation}
    \label{eq:lambda_G}
    \lambda_G = \frac{h \cdot c}{e \cdot U}
\end{equation}

$h$  ist dabei  die Planck-Konstante,  $c$ die  Lichtgeschwindigkeit, $e$  die
Ladung eines Elektrons und $U$ die R\"ohrenspannung.

% ---------------------------------------------------------------------------- %
\subsubsection{Die charakteristische Strahlung}
\label{subsubsec:charaktStrahlung}
% ---------------------------------------------------------------------------- %

Die charakteristische Strahlung geht von den Atomen des Anodenmaterials selbst aus.
Sie besteht aus Photonen, die bei Elektronen\"uberg\"angen in der kernnahen Atomh\"ulle
abgegeben werden:

\begin{minipage}[c][][b]{0.585\textwidth}
    \begin{itemize}
        \item
            L-Schale $\rightarrow$ K-Schale: $K_\alpha$-Strahlung
        \item
            M-Schale $\rightarrow$ K-Schale: $K_\beta$-Strahlung
        \item
            M-, N-, O-Schale $\rightarrow$ L-Schale: $L$-Strahlung
    \end{itemize}

    Solche  \"Uberg\"ange werden  erm\"oglicht  durch  das herausschlagen  von
    Elektronen aus einer inneren Schalde (Elektronenstoss/Stossionisation oder
    Absorption von R\"ontgen-Strahlung/Photoionisation).

\end{minipage}
\begin{minipage}[c][][b]{0.4\textwidth}
%\begin{figure}[h!]
    \centering
    \includegraphics[width=0.95\textwidth]{images/charakt-strahlung.png}
    \captionof{figure}{%
        Schema der Emittierung von charakteristischen Photonen \emph{Quelle}: Versuchsanleitung
    }
    \label{fig:charaktStrahlung}
%\end{figure}
\end{minipage}

Die beiden K-Linien dominieren dabei das Spektrum.

% ---------------------------------------------------------------------------- %
\subsection[Beugung von R\"ontgen-Strahlung an Kristallen]{Beugung von R\"ontgen-Strahlung an Kristallen, R\"ontgen-Spektrometer}
\label{subsec:rontgenBeugung}
% ---------------------------------------------------------------------------- %

\begin{minipage}[c][][b]{0.585\textwidth}
    R\"ontgenstrahlen  werden  an  einem   Kristallgitter  gebeugt,  wenn  die
    Bragg'sche Gleichung (Gleichung \ref{eq:bragg}) erf\"ullt ist:

    \begin{equation}
        \label{eq:bragg}
        2 \cdot d \cdot sin \vartheta_n = n \cdot \lambda
    \end{equation}

    Dabei   ist  $d$   der  Netzebenenabstand. Netzebenen   sind  von   Atomen
    regelm\"assig belegte  Ebenen in einer Kristallstruktur,  entsprechen also
    nicht unbedingt den Gitterf\"achen (bzw. $d$ ist nicht unbedingt identisch
    zu einer Gitterkonstanten).

    Abbildung \ref{fig:braggHerleitung}  stellt schematisch das  Einfallen und
    Reflektieren  von  Strahlung  in  und  an  einem  Kristallgitter  und  die
    Netzebenen dar.

    $\vartheta$ ist  der so  genannte \textbf{Glanzwinkel}. Er  beschreibt den
    Winkel zwischen Netzebene und ein- bzw. ausfallendem Strahl.

\end{minipage}
\begin{minipage}[c][][b]{0.4\textwidth}
    \centering
    \includegraphics[width=0.95\textwidth]{images/bragg-herleitung.png}
    \captionof{figure}{%
        Schema     zur      Herleitung     der      Bragg'schen     Gleichung.
        \emph{Quelle:} Versuchsanleitung
    }
    \label{fig:braggHerleitung}
\end{minipage}

Es gibt  verschiedene Verfahren, um  sich das R\"ontgenstrahlung  zum Einblick
ins Innere einer  Kristallstruktur zu Nutze zu machen. In  diesem Versuch wird
die \textbf{Bragg'sche Drehkristallmethode} verwendet.

Dabei wird ein  Kristall in einer Halterung rotiert  und mit monochromatischer
Strahlung   bestrahlt. Nur  bei   bestimmten  Winkeln   wird  der   Strahl  am
Kristall   reflektiert  und   im   Z\"ahlrohr   detektiert  (siehe   Abbildung
\ref{fig:braggDrehkristall}).

\begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\textwidth]{images/bragg-drehkristall.png}
    \caption{%
        Schema der Versuchsanordnung
        \emph{Quelle:} Versuchsanleitung
    }
    \label{fig:braggDrehkristall}
\end{figure}


text:
package linex;

public class SizeMismatchException extends Exception{

	private static final long serialVersionUID = -8309763462205987262L;

	public SizeMismatchException(){
		super();
	}
	public SizeMismatchException(String msg){
		super(msg);
	}
	public SizeMismatchException(String msg, Throwable cause){
		super(msg, cause);
	}
	public SizeMismatchException(Throwable cause){
		super(cause);
	}

}


text:
.class public final Lcom/android/server/om/OverlayManagerService;
.super Lcom/android/server/SystemService;
.source "OverlayManagerService.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/server/om/OverlayManagerService$1;,
        Lcom/android/server/om/OverlayManagerService$OverlayChangeListener;,
        Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;,
        Lcom/android/server/om/OverlayManagerService$PackageReceiver;,
        Lcom/android/server/om/OverlayManagerService$ThemeAppliedReceiver;,
        Lcom/android/server/om/OverlayManagerService$UserReceiver;
    }
.end annotation

# static fields
.field static final DEBUG:Z

.field private static final DEFAULT_OVERLAYS_PROP:Ljava/lang/String; = "ro.boot.vendor.overlay.theme"

.field static final TAG:Ljava/lang/String; = "OverlayManager"

# instance fields
.field private final mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

.field private mInitCompleteSignal:Ljava/util/concurrent/Future;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/Future",
            "<*>;"
        }
    .end annotation
.end field

.field private final mLock:Ljava/lang/Object;

.field private final mPackageManager:Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

.field private final mPersistSettingsScheduled:Ljava/util/concurrent/atomic/AtomicBoolean;

.field private mResetSettings:Z

.field private final mService:Landroid/os/IBinder;

.field private final mSettings:Lcom/android/server/om/OverlayManagerSettings;

.field private final mSettingsFile:Landroid/util/AtomicFile;

.field private final mUserManager:Lcom/android/server/pm/UserManagerService;

# direct methods
.method static synthetic -get0(Lcom/android/server/om/OverlayManagerService;)Lcom/android/server/om/OverlayManagerServiceImpl;
    .locals 1

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    return-object v0
.end method

.method static synthetic -get1(Lcom/android/server/om/OverlayManagerService;)Ljava/lang/Object;
    .locals 1

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    return-object v0
.end method

.method static synthetic -get2(Lcom/android/server/om/OverlayManagerService;)Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;
    .locals 1

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mPackageManager:Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

    return-object v0
.end method

.method static synthetic -get3(Lcom/android/server/om/OverlayManagerService;)Lcom/android/server/pm/UserManagerService;
    .locals 1

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mUserManager:Lcom/android/server/pm/UserManagerService;

    return-object v0
.end method

.method static synthetic -wrap0(Lcom/android/server/om/OverlayManagerService;Landroid/content/pm/PackageInfo;)Z
    .locals 1

    invoke-direct {p0, p1}, Lcom/android/server/om/OverlayManagerService;->isOverlayPackage(Landroid/content/pm/PackageInfo;)Z

    move-result v0

    return v0
.end method

.method static synthetic -wrap1(Lcom/android/server/om/OverlayManagerService;)V
    .locals 0

    invoke-direct {p0}, Lcom/android/server/om/OverlayManagerService;->readResetSettingsValue()V

    return-void
.end method

.method static synthetic -wrap2(Lcom/android/server/om/OverlayManagerService;)V
    .locals 0

    invoke-direct {p0}, Lcom/android/server/om/OverlayManagerService;->schedulePersistSettings()V

    return-void
.end method

.method static synthetic -wrap3(Lcom/android/server/om/OverlayManagerService;ILjava/lang/String;Z)V
    .locals 0

    invoke-direct {p0, p1, p2, p3}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/lang/String;Z)V

    return-void
.end method

.method static synthetic -wrap4(Lcom/android/server/om/OverlayManagerService;ILjava/lang/String;)V
    .locals 0

    invoke-direct {p0, p1, p2}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/lang/String;)V

    return-void
.end method

.method static synthetic -wrap5(Lcom/android/server/om/OverlayManagerService;ILjava/util/List;)V
    .locals 0

    invoke-direct {p0, p1, p2}, Lcom/android/server/om/OverlayManagerService;->updateOverlayPaths(ILjava/util/List;)V

    return-void
.end method

.method static constructor <clinit>()V
    .locals 2

    const-string/jumbo v0, "eng"

    sget-object v1, Landroid/os/Build;->TYPE:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    sput-boolean v0, Lcom/android/server/om/OverlayManagerService;->DEBUG:Z

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Lcom/android/server/pm/Installer;)V
    .locals 7

    const/4 v1, 0x0

    invoke-direct {p0, p1}, Lcom/android/server/SystemService;-><init>(Landroid/content/Context;)V

    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mPersistSettingsScheduled:Ljava/util/concurrent/atomic/AtomicBoolean;

    iput-boolean v1, p0, Lcom/android/server/om/OverlayManagerService;->mResetSettings:Z

    new-instance v0, Lcom/android/server/om/OverlayManagerService$1;

    invoke-direct {v0, p0}, Lcom/android/server/om/OverlayManagerService$1;-><init>(Lcom/android/server/om/OverlayManagerService;)V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mService:Landroid/os/IBinder;

    new-instance v0, Landroid/util/AtomicFile;

    new-instance v1, Ljava/io/File;

    invoke-static {}, Landroid/os/Environment;->getDataSystemDirectory()Ljava/io/File;

    move-result-object v3

    const-string/jumbo v4, "overlays.xml"

    invoke-direct {v1, v3, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-direct {v0, v1}, Landroid/util/AtomicFile;-><init>(Ljava/io/File;)V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    new-instance v0, Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

    invoke-direct {v0}, Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;-><init>()V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mPackageManager:Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

    invoke-static {}, Lcom/android/server/pm/UserManagerService;->getInstance()Lcom/android/server/pm/UserManagerService;

    move-result-object v0

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mUserManager:Lcom/android/server/pm/UserManagerService;

    new-instance v2, Lcom/android/server/om/IdmapManager;

    invoke-direct {v2, p2}, Lcom/android/server/om/IdmapManager;-><init>(Lcom/android/server/pm/Installer;)V

    new-instance v0, Lcom/android/server/om/OverlayManagerSettings;

    invoke-direct {v0}, Lcom/android/server/om/OverlayManagerSettings;-><init>()V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    new-instance v0, Lcom/android/server/om/OverlayManagerServiceImpl;

    iget-object v1, p0, Lcom/android/server/om/OverlayManagerService;->mPackageManager:Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

    iget-object v3, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    invoke-static {}, Lcom/android/server/om/OverlayManagerService;->getDefaultOverlayPackages()Ljava/util/Set;

    move-result-object v4

    new-instance v5, Lcom/android/server/om/OverlayManagerService$OverlayChangeListener;

    const/4 v6, 0x0

    invoke-direct {v5, p0, v6}, Lcom/android/server/om/OverlayManagerService$OverlayChangeListener;-><init>(Lcom/android/server/om/OverlayManagerService;Lcom/android/server/om/OverlayManagerService$OverlayChangeListener;)V

    invoke-direct/range {v0 .. v5}, Lcom/android/server/om/OverlayManagerServiceImpl;-><init>(Lcom/android/server/om/OverlayManagerServiceImpl$PackageManagerHelper;Lcom/android/server/om/IdmapManager;Lcom/android/server/om/OverlayManagerSettings;Ljava/util/Set;Lcom/android/server/om/OverlayManagerServiceImpl$OverlayChangeListener;)V

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    invoke-static {}, Lcom/android/server/SystemServerInitThreadPool;->get()Lcom/android/server/SystemServerInitThreadPool;

    move-result-object v0

    new-instance v1, Lcom/android/server/om/-$Lambda$Whs3NIaASrs6bpQxTTs9leTDPyo;

    invoke-direct {v1, p0}, Lcom/android/server/om/-$Lambda$Whs3NIaASrs6bpQxTTs9leTDPyo;-><init>(Ljava/lang/Object;)V

    const-string/jumbo v3, "Init OverlayManagerService"

    invoke-virtual {v0, v1, v3}, Lcom/android/server/SystemServerInitThreadPool;->submit(Ljava/lang/Runnable;Ljava/lang/String;)Ljava/util/concurrent/Future;

    move-result-object v0

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mInitCompleteSignal:Ljava/util/concurrent/Future;

    return-void
.end method

.method private static getDefaultOverlayPackages()Ljava/util/Set;
    .locals 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Set",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    const-string/jumbo v3, "ro.boot.vendor.overlay.theme"

    invoke-static {v3}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v3

    if-eqz v3, :cond_0

    invoke-static {}, Ljava/util/Collections;->emptySet()Ljava/util/Set;

    move-result-object v3

    return-object v3

    :cond_0
    new-instance v0, Landroid/util/ArraySet;

    invoke-direct {v0}, Landroid/util/ArraySet;-><init>()V

    const-string/jumbo v3, ";"

    invoke-virtual {v2, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v4

    const/4 v3, 0x0

    array-length v5, v4

    :goto_0
    if-ge v3, v5, :cond_2

    aget-object v1, v4, v3

    invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v6

    if-nez v6, :cond_1

    invoke-virtual {v0, v1}, Landroid/util/ArraySet;->add(Ljava/lang/Object;)Z

    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_2
    return-object v0
.end method

.method private initIfNeeded()V
    .locals 9

    invoke-virtual {p0}, Lcom/android/server/om/OverlayManagerService;->getContext()Landroid/content/Context;

    move-result-object v6

    const-class v7, Landroid/os/UserManager;

    invoke-virtual {v6, v7}, Landroid/content/Context;->getSystemService(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/os/UserManager;

    const/4 v6, 0x1

    invoke-virtual {v2, v6}, Landroid/os/UserManager;->getUsers(Z)Ljava/util/List;

    move-result-object v5

    iget-object v7, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v7

    :try_start_0
    invoke-interface {v5}, Ljava/util/List;->size()I

    move-result v3

    const/4 v0, 0x0

    :goto_0
    if-ge v0, v3, :cond_1

    invoke-interface {v5, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Landroid/content/pm/UserInfo;

    invoke-virtual {v4}, Landroid/content/pm/UserInfo;->supportsSwitchTo()Z

    move-result v6

    if-nez v6, :cond_0

    iget v6, v4, Landroid/content/pm/UserInfo;->id:I

    if-eqz v6, :cond_0

    iget-object v8, p0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    invoke-interface {v5, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/pm/UserInfo;

    iget v6, v6, Landroid/content/pm/UserInfo;->id:I

    invoke-virtual {v8, v6}, Lcom/android/server/om/OverlayManagerServiceImpl;->updateOverlaysForUser(I)Ljava/util/ArrayList;

    move-result-object v1

    invoke-interface {v5, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/pm/UserInfo;

    iget v6, v6, Landroid/content/pm/UserInfo;->id:I

    invoke-direct {p0, v6, v1}, Lcom/android/server/om/OverlayManagerService;->updateOverlayPaths(ILjava/util/List;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    monitor-exit v7

    return-void

    :catchall_0
    move-exception v6

    monitor-exit v7

    throw v6
.end method

.method private isOverlayPackage(Landroid/content/pm/PackageInfo;)Z
    .locals 2

    const/4 v0, 0x0

    if-eqz p1, :cond_0

    iget-object v1, p1, Landroid/content/pm/PackageInfo;->overlayTarget:Ljava/lang/String;

    if-eqz v1, :cond_0

    const/4 v0, 0x1

    :cond_0
    return v0
.end method

.method private readResetSettingsValue()V
    .locals 13

    const/4 v10, 0x0

    const-string/jumbo v0, "reset_setting"

    new-instance v4, Ljava/io/File;

    const-string/jumbo v9, "/data/overlays/preferences/samsung.andorid.themes.component_preference.xml"

    invoke-direct {v4, v9}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    const/4 v8, 0x0

    const/4 v7, 0x0

    const/4 v5, 0x0

    const/4 v1, 0x0

    :try_start_0
    new-instance v6, Ljava/io/FileInputStream;

    invoke-direct {v6, v4}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_3
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    :try_start_1
    new-instance v2, Ljava/io/BufferedInputStream;

    const/16 v9, 0x4000

    invoke-direct {v2, v6, v9}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;I)V
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_7
    .catchall {:try_start_1 .. :try_end_1} :catchall_2

    :try_start_2
    invoke-static {v2}, Lcom/android/internal/util/XmlUtils;->readMapXml(Ljava/io/InputStream;)Ljava/util/HashMap;

    move-result-object v8

    move-object v7, v8

    const-string/jumbo v9, "reset_setting"

    invoke-interface {v8, v9}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v9

    check-cast v9, Ljava/lang/Boolean;

    invoke-virtual {v9}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v9

    iput-boolean v9, p0, Lcom/android/server/om/OverlayManagerService;->mResetSettings:Z
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_8
    .catchall {:try_start_2 .. :try_end_2} :catchall_3

    if-eqz v2, :cond_0

    :try_start_3
    invoke-virtual {v2}, Ljava/io/BufferedInputStream;->close()V
    :try_end_3
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0

    :cond_0
    :goto_0
    if-eqz v6, :cond_1

    :try_start_4
    invoke-virtual {v6}, Ljava/io/FileInputStream;->close()V
    :try_end_4
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_4} :catch_2
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0

    :cond_1
    move-object v9, v10

    :cond_2
    :goto_1
    if-eqz v9, :cond_3

    :try_start_5
    throw v9
    :try_end_5
    .catch Ljava/lang/Exception; {:try_start_5 .. :try_end_5} :catch_0

    :catch_0
    move-exception v3

    move-object v1, v2

    move-object v5, v6

    :goto_2
    invoke-virtual {v3}, Ljava/lang/Exception;->printStackTrace()V

    :goto_3
    return-void

    :catch_1
    move-exception v10

    goto :goto_0

    :catch_2
    move-exception v9

    if-eqz v10, :cond_2

    if-eq v10, v9, :cond_1

    :try_start_6
    invoke-virtual {v10, v9}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_0

    move-object v9, v10

    goto :goto_1

    :cond_3
    move-object v1, v2

    move-object v5, v6

    goto :goto_3

    :catch_3
    move-exception v9

    :goto_4
    :try_start_7
    throw v9
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_0

    :catchall_0
    move-exception v10

    move-object v12, v10

    move-object v10, v9

    move-object v9, v12

    :goto_5
    if-eqz v1, :cond_4

    :try_start_8
    invoke-virtual {v1}, Ljava/io/BufferedInputStream;->close()V
    :try_end_8
    .catch Ljava/lang/Throwable; {:try_start_8 .. :try_end_8} :catch_5
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_8} :catch_4

    :cond_4
    move-object v11, v10

    :cond_5
    :goto_6
    if-eqz v5, :cond_6

    :try_start_9
    invoke-virtual {v5}, Ljava/io/FileInputStream;->close()V
    :try_end_9
    .catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_9} :catch_6
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_9} :catch_4

    :cond_6
    move-object v10, v11

    :cond_7
    :goto_7
    if-eqz v10, :cond_8

    :try_start_a
    throw v10

    :catch_4
    move-exception v3

    goto :goto_2

    :catch_5
    move-exception v11

    if-eqz v10, :cond_5

    if-eq v10, v11, :cond_4

    invoke-virtual {v10, v11}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    move-object v11, v10

    goto :goto_6

    :catch_6
    move-exception v10

    if-eqz v11, :cond_7

    if-eq v11, v10, :cond_6

    invoke-virtual {v11, v10}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    move-object v10, v11

    goto :goto_7

    :cond_8
    throw v9
    :try_end_a
    .catch Ljava/lang/Exception; {:try_start_a .. :try_end_a} :catch_4

    :catchall_1
    move-exception v9

    goto :goto_5

    :catchall_2
    move-exception v9

    move-object v5, v6

    goto :goto_5

    :catchall_3
    move-exception v9

    move-object v1, v2

    move-object v5, v6

    goto :goto_5

    :catch_7
    move-exception v9

    move-object v5, v6

    goto :goto_4

    :catch_8
    move-exception v9

    move-object v1, v2

    move-object v5, v6

    goto :goto_4
.end method

.method private restoreSettings()V
    .locals 13

    const/4 v8, 0x0

    const/4 v7, 0x0

    iget-object v9, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v9

    :try_start_0
    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    invoke-virtual {v6}, Landroid/util/AtomicFile;->getBaseFile()Ljava/io/File;

    move-result-object v6

    invoke-virtual {v6}, Ljava/io/File;->exists()Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    move-result v6

    if-nez v6, :cond_0

    monitor-exit v9

    return-void

    :cond_0
    const/4 v4, 0x0

    :try_start_1
    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    invoke-virtual {v6}, Landroid/util/AtomicFile;->openRead()Ljava/io/FileInputStream;

    move-result-object v4

    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    invoke-virtual {v6, v4}, Lcom/android/server/om/OverlayManagerSettings;->restore(Ljava/io/InputStream;)V

    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mUserManager:Lcom/android/server/pm/UserManagerService;

    const/4 v10, 0x1

    invoke-virtual {v6, v10}, Lcom/android/server/pm/UserManagerService;->getUsers(Z)Ljava/util/List;

    move-result-object v3

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v6

    new-array v2, v6, [I

    const/4 v1, 0x0

    :goto_0
    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v6

    if-ge v1, v6, :cond_1

    invoke-interface {v3, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/pm/UserInfo;

    invoke-virtual {v6}, Landroid/content/pm/UserInfo;->getUserHandle()Landroid/os/UserHandle;

    move-result-object v6

    invoke-virtual {v6}, Landroid/os/UserHandle;->getIdentifier()I

    move-result v6

    aput v6, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    invoke-static {v2}, Ljava/util/Arrays;->sort([I)V

    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    invoke-virtual {v6}, Lcom/android/server/om/OverlayManagerSettings;->getUsers()[I

    move-result-object v10

    array-length v11, v10

    move v6, v8

    :goto_1
    if-ge v6, v11, :cond_3

    aget v5, v10, v6

    invoke-static {v2, v5}, Ljava/util/Arrays;->binarySearch([II)I

    move-result v8

    if-gez v8, :cond_2

    iget-object v8, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    invoke-virtual {v8, v5}, Lcom/android/server/om/OverlayManagerSettings;->removeUser(I)Z
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_2
    .catchall {:try_start_1 .. :try_end_1} :catchall_2

    :cond_2
    add-int/lit8 v6, v6, 0x1

    goto :goto_1

    :cond_3
    if-eqz v4, :cond_4

    :try_start_2
    invoke-virtual {v4}, Ljava/io/FileInputStream;->close()V
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    :cond_4
    :goto_2
    if-eqz v7, :cond_5

    :try_start_3
    throw v7
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_3 .. :try_end_3} :catch_0
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    :catch_0
    move-exception v0

    :try_start_4
    const-string/jumbo v6, "OverlayManager"

    const-string/jumbo v7, "failed to restore overlay state"

    invoke-static {v6, v7, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1

    :cond_5
    monitor-exit v9

    return-void

    :catch_1
    move-exception v7

    goto :goto_2

    :catch_2
    move-exception v6

    :try_start_5
    throw v6
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    :catchall_0
    move-exception v7

    move-object v12, v7

    move-object v7, v6

    move-object v6, v12

    :goto_3
    if-eqz v4, :cond_6

    :try_start_6
    invoke-virtual {v4}, Ljava/io/FileInputStream;->close()V
    :try_end_6
    .catch Ljava/lang/Throwable; {:try_start_6 .. :try_end_6} :catch_3
    .catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_6 .. :try_end_6} :catch_0
    .catchall {:try_start_6 .. :try_end_6} :catchall_1

    :cond_6
    :goto_4
    if-eqz v7, :cond_8

    :try_start_7
    throw v7
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_7 .. :try_end_7} :catch_0
    .catchall {:try_start_7 .. :try_end_7} :catchall_1

    :catchall_1
    move-exception v6

    monitor-exit v9

    throw v6

    :catch_3
    move-exception v8

    if-nez v7, :cond_7

    move-object v7, v8

    goto :goto_4

    :cond_7
    if-eq v7, v8, :cond_6

    :try_start_8
    invoke-virtual {v7, v8}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    goto :goto_4

    :cond_8
    throw v6
    :try_end_8
    .catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_8 .. :try_end_8} :catch_0
    .catchall {:try_start_8 .. :try_end_8} :catchall_1

    :catchall_2
    move-exception v6

    goto :goto_3
.end method

.method private schedulePersistSettings()V
    .locals 2

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mPersistSettingsScheduled:Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->getAndSet(Z)Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    :cond_0
    invoke-static {}, Lcom/android/server/IoThread;->getHandler()Landroid/os/Handler;

    move-result-object v0

    new-instance v1, Lcom/android/server/om/-$Lambda$Whs3NIaASrs6bpQxTTs9leTDPyo$1;

    invoke-direct {v1, p0}, Lcom/android/server/om/-$Lambda$Whs3NIaASrs6bpQxTTs9leTDPyo$1;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    return-void
.end method

.method private updateAssets(ILjava/lang/String;)V
    .locals 2

    invoke-static {p2}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    const/4 v1, 0x0

    invoke-direct {p0, p1, v0, v1}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/util/List;Z)V

    return-void
.end method

.method private updateAssets(ILjava/lang/String;Z)V
    .locals 1

    if-nez p2, :cond_0

    return-void

    :cond_0
    invoke-static {p2}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    invoke-direct {p0, p1, v0, p3}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/util/List;Z)V

    return-void
.end method

.method private updateAssets(ILjava/util/List;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/util/List;Z)V

    return-void
.end method

.method private updateAssets(ILjava/util/List;Z)V
    .locals 8
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;Z)V"
        }
    .end annotation

    if-eqz p3, :cond_0

    iget-boolean v5, p0, Lcom/android/server/om/OverlayManagerService;->mResetSettings:Z

    if-eqz v5, :cond_0

    return-void

    :cond_0
    invoke-direct {p0, p1, p2}, Lcom/android/server/om/OverlayManagerService;->updateOverlayPaths(ILjava/util/List;)V

    invoke-static {}, Landroid/app/ActivityManager;->getService()Landroid/app/IActivityManager;

    move-result-object v0

    if-eqz p3, :cond_3

    if-eqz v0, :cond_3

    invoke-interface {p2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;

    move-result-object v4

    :cond_1
    :goto_0
    invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

    move-result v5

    if-eqz v5, :cond_4

    invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/String;

    sget-object v5, Landroid/content/om/OpenThemeConstants;->immortalApps:Ljava/util/ArrayList;

    invoke-virtual {v5, v3}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v5

    if-nez v5, :cond_1

    iget-object v6, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v6

    :try_start_0
    iget-object v5, p0, Lcom/android/server/om/OverlayManagerService;->mPackageManager:Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;

    const/4 v7, 0x0

    invoke-virtual {v5, v3, p1, v7}, Lcom/android/server/om/OverlayManagerService$PackageManagerHelper;->getPackageInfo(Ljava/lang/String;IZ)Landroid/content/pm/PackageInfo;

    move-result-object v2

    if-eqz v2, :cond_2

    iget-object v5, v2, Landroid/content/pm/PackageInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v5, :cond_2

    :try_start_1
    iget-object v5, v2, Landroid/content/pm/PackageInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo;

    iget v5, v5, Landroid/content/pm/ApplicationInfo;->uid:I

    const-string/jumbo v7, "update-overlay"

    invoke-interface {v0, v3, v5, p1, v7}, Landroid/app/IActivityManager;->killApplication(Ljava/lang/String;IILjava/lang/String;)V
    :try_end_1
    .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :cond_2
    :goto_1
    monitor-exit v6

    goto :goto_0

    :catch_0
    move-exception v1

    :try_start_2
    invoke-virtual {v1}, Landroid/os/RemoteException;->printStackTrace()V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_1

    :catchall_0
    move-exception v5

    monitor-exit v6

    throw v5

    :cond_3
    if-eqz v0, :cond_4

    :try_start_3
    invoke-interface {v0, p2, p1}, Landroid/app/IActivityManager;->scheduleApplicationInfoChanged(Ljava/util/List;I)V
    :try_end_3
    .catch Landroid/os/RemoteException; {:try_start_3 .. :try_end_3} :catch_1

    :cond_4
    :goto_2
    return-void

    :catch_1
    move-exception v1

    goto :goto_2
.end method

.method private updateOverlayPaths(ILjava/util/List;)V
    .locals 17
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

    sget-boolean v12, Lcom/android/server/om/OverlayManagerService;->DEBUG:Z

    if-eqz v12, :cond_0

    const-string/jumbo v12, "OverlayManager"

    new-instance v13, Ljava/lang/StringBuilder;

    invoke-direct {v13}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v14, "Updating overlay assets contains overlay for android ?"

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string/jumbo v14, "android"

    move-object/from16 v0, p2

    invoke-interface {v0, v14}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v14

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v13

    const-string/jumbo v14, " "

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    move-object/from16 v0, p2

    invoke-virtual {v13, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v13

    invoke-static {v12, v13}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_0
    const-class v12, Landroid/content/pm/PackageManagerInternal;

    invoke-static {v12}, Lcom/android/server/LocalServices;->getService(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v9

    check-cast v9, Landroid/content/pm/PackageManagerInternal;

    const-string/jumbo v12, "android"

    move-object/from16 v0, p2

    invoke-interface {v0, v12}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v11

    if-eqz v11, :cond_2

    const/4 v4, 0x0

    move-object/from16 v0, p0

    iget-object v13, v0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v13

    :try_start_0
    move-object/from16 v0, p0

    iget-object v12, v0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    const-string/jumbo v14, "android"

    move/from16 v0, p1

    invoke-virtual {v12, v14, v0}, Lcom/android/server/om/OverlayManagerServiceImpl;->getOverlayInfosForTarget(Ljava/lang/String;I)Ljava/util/List;

    move-result-object v7

    if-eqz v7, :cond_1

    invoke-interface {v7}, Ljava/util/List;->isEmpty()Z

    move-result v12

    xor-int/lit8 v12, v12, 0x1

    if-eqz v12, :cond_1

    const/4 v3, 0x0

    :goto_0
    invoke-interface {v7}, Ljava/util/List;->size()I

    move-result v12

    if-ge v3, v12, :cond_1

    invoke-interface {v7, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/om/OverlayInfo;

    if-eqz v6, :cond_4

    invoke-virtual {v6}, Landroid/content/om/OverlayInfo;->isEnabled()Z

    move-result v12

    if-eqz v12, :cond_4

    iget-object v12, v6, Landroid/content/om/OverlayInfo;->baseCodePath:Ljava/lang/String;

    if-eqz v12, :cond_4

    iget-object v12, v6, Landroid/content/om/OverlayInfo;->baseCodePath:Ljava/lang/String;

    const-string/jumbo v14, "/data/overlays/currentstyle"

    invoke-virtual {v12, v14}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v12

    if-eqz v12, :cond_4

    const/4 v4, 0x1

    :cond_1
    monitor-exit v13

    if-nez v4, :cond_5

    move/from16 v0, p1

    invoke-virtual {v9, v0}, Landroid/content/pm/PackageManagerInternal;->getTargetPackageNames(I)Ljava/util/List;

    move-result-object p2

    :cond_2
    :goto_1
    new-instance v8, Landroid/util/ArrayMap;

    invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I

    move-result v12

    invoke-direct {v8, v12}, Landroid/util/ArrayMap;-><init>(I)V

    move-object/from16 v0, p0

    iget-object v13, v0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v13

    :try_start_1
    move-object/from16 v0, p0

    iget-object v12, v0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    const-string/jumbo v14, "android"

    move/from16 v0, p1

    invoke-virtual {v12, v14, v0}, Lcom/android/server/om/OverlayManagerServiceImpl;->getEnabledOverlayPackageNames(Ljava/lang/String;I)Ljava/util/List;

    move-result-object v2

    invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I

    move-result v1

    const/4 v3, 0x0

    :goto_2
    if-ge v3, v1, :cond_6

    move-object/from16 v0, p2

    invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Ljava/lang/String;

    new-instance v5, Ljava/util/ArrayList;

    invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V

    const-string/jumbo v12, "android"

    invoke-virtual {v12, v10}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v12

    if-nez v12, :cond_3

    invoke-interface {v5, v2}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    :cond_3
    move-object/from16 v0, p0

    iget-object v12, v0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    move/from16 v0, p1

    invoke-virtual {v12, v10, v0}, Lcom/android/server/om/OverlayManagerServiceImpl;->getEnabledOverlayPackageNames(Ljava/lang/String;I)Ljava/util/List;

    move-result-object v12

    invoke-interface {v5, v12}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    invoke-interface {v8, v10, v5}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    add-int/lit8 v3, v3, 0x1

    goto :goto_2

    :cond_4
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :catchall_0
    move-exception v12

    monitor-exit v13

    throw v12

    :cond_5
    move/from16 v0, p1

    invoke-virtual {v9, v0}, Landroid/content/pm/PackageManagerInternal;->getOpenThemeTargetPackageNames(I)Ljava/util/List;

    move-result-object p2

    sget-boolean v12, Lcom/android/server/om/OverlayManagerService;->DEBUG:Z

    if-eqz v12, :cond_2

    const-string/jumbo v12, "OverlayManager"

    new-instance v13, Ljava/lang/StringBuilder;

    invoke-direct {v13}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v14, "updateAssetsLocked for fwk, targets "

    invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v13

    move-object/from16 v0, p2

    invoke-virtual {v13, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v13

    invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v13

    invoke-static {v12, v13}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    :cond_6
    monitor-exit v13

    invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I

    move-result v1

    const/4 v3, 0x0

    :goto_3
    if-ge v3, v1, :cond_9

    move-object/from16 v0, p2

    invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Ljava/lang/String;

    sget-boolean v12, Lcom/android/server/om/OverlayManagerService;->DEBUG:Z

    if-eqz v12, :cond_7

    const-string/jumbo v13, "OverlayManager"

    new-instance v12, Ljava/lang/StringBuilder;

    invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v14, "-> Updating overlay: target="

    invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v12

    invoke-virtual {v12, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v12

    const-string/jumbo v14, " overlays=["

    invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v14

    const-string/jumbo v15, ","

    invoke-interface {v8, v10}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Ljava/lang/Iterable;

    invoke-static {v15, v12}, Landroid/text/TextUtils;->join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v14, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v12

    const-string/jumbo v14, "] userId="

    invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v12

    move/from16 v0, p1

    invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v12

    invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v12

    invoke-static {v13, v12}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_7
    invoke-interface {v8, v10}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Ljava/util/List;

    move/from16 v0, p1

    invoke-virtual {v9, v0, v10, v12}, Landroid/content/pm/PackageManagerInternal;->setEnabledOverlayPackages(ILjava/lang/String;Ljava/util/List;)Z

    move-result v12

    if-nez v12, :cond_8

    const-string/jumbo v12, "OverlayManager"

    const-string/jumbo v13, "Failed to change enabled overlays for %s user %d"

    const/4 v14, 0x2

    new-array v14, v14, [Ljava/lang/Object;

    const/4 v15, 0x0

    aput-object v10, v14, v15

    invoke-static/range {p1 .. p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v15

    const/16 v16, 0x1

    aput-object v15, v14, v16

    invoke-static {v13, v14}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v13

    invoke-static {v12, v13}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :cond_8
    add-int/lit8 v3, v3, 0x1

    goto :goto_3

    :catchall_1
    move-exception v12

    monitor-exit v13

    throw v12

    :cond_9
    return-void
.end method

# virtual methods
.method synthetic lambda$-com_android_server_om_OverlayManagerService_10396()V
    .locals 15

    const/4 v4, 0x0

    new-instance v3, Landroid/content/IntentFilter;

    invoke-direct {v3}, Landroid/content/IntentFilter;-><init>()V

    const-string/jumbo v0, "android.intent.action.PACKAGE_ADDED"

    invoke-virtual {v3, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string/jumbo v0, "android.intent.action.PACKAGE_CHANGED"

    invoke-virtual {v3, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string/jumbo v0, "android.intent.action.PACKAGE_REMOVED"

    invoke-virtual {v3, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string/jumbo v0, "package"

    invoke-virtual {v3, v0}, Landroid/content/IntentFilter;->addDataScheme(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/android/server/om/OverlayManagerService;->getContext()Landroid/content/Context;

    move-result-object v0

    new-instance v1, Lcom/android/server/om/OverlayManagerService$PackageReceiver;

    invoke-direct {v1, p0, v4}, Lcom/android/server/om/OverlayManagerService$PackageReceiver;-><init>(Lcom/android/server/om/OverlayManagerService;Lcom/android/server/om/OverlayManagerService$PackageReceiver;)V

    sget-object v2, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle;

    move-object v5, v4

    invoke-virtual/range {v0 .. v5}, Landroid/content/Context;->registerReceiverAsUser(Landroid/content/BroadcastReceiver;Landroid/os/UserHandle;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;

    new-instance v8, Landroid/content/IntentFilter;

    invoke-direct {v8}, Landroid/content/IntentFilter;-><init>()V

    const-string/jumbo v0, "android.intent.action.USER_ADDED"

    invoke-virtual {v8, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string/jumbo v0, "android.intent.action.USER_REMOVED"

    invoke-virtual {v8, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/android/server/om/OverlayManagerService;->getContext()Landroid/content/Context;

    move-result-object v5

    new-instance v6, Lcom/android/server/om/OverlayManagerService$UserReceiver;

    invoke-direct {v6, p0, v4}, Lcom/android/server/om/OverlayManagerService$UserReceiver;-><init>(Lcom/android/server/om/OverlayManagerService;Lcom/android/server/om/OverlayManagerService$UserReceiver;)V

    sget-object v7, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle;

    move-object v9, v4

    move-object v10, v4

    invoke-virtual/range {v5 .. v10}, Landroid/content/Context;->registerReceiverAsUser(Landroid/content/BroadcastReceiver;Landroid/os/UserHandle;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;

    new-instance v12, Landroid/content/IntentFilter;

    invoke-direct {v12}, Landroid/content/IntentFilter;-><init>()V

    const-string/jumbo v0, "com.samsung.android.theme.themecenter.THEME_APPLY"

    invoke-virtual {v12, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/android/server/om/OverlayManagerService;->getContext()Landroid/content/Context;

    move-result-object v9

    new-instance v10, Lcom/android/server/om/OverlayManagerService$ThemeAppliedReceiver;

    invoke-direct {v10, p0, v4}, Lcom/android/server/om/OverlayManagerService$ThemeAppliedReceiver;-><init>(Lcom/android/server/om/OverlayManagerService;Lcom/android/server/om/OverlayManagerService$ThemeAppliedReceiver;)V

    sget-object v11, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle;

    move-object v13, v4

    move-object v14, v4

    invoke-virtual/range {v9 .. v14}, Landroid/content/Context;->registerReceiverAsUser(Landroid/content/BroadcastReceiver;Landroid/os/UserHandle;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;

    invoke-direct {p0}, Lcom/android/server/om/OverlayManagerService;->restoreSettings()V

    invoke-direct {p0}, Lcom/android/server/om/OverlayManagerService;->initIfNeeded()V

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/server/om/OverlayManagerService;->onSwitchUser(I)V

    const-string/jumbo v0, "overlay"

    iget-object v1, p0, Lcom/android/server/om/OverlayManagerService;->mService:Landroid/os/IBinder;

    invoke-virtual {p0, v0, v1}, Lcom/android/server/om/OverlayManagerService;->publishBinderService(Ljava/lang/String;Landroid/os/IBinder;)V

    const-class v0, Lcom/android/server/om/OverlayManagerService;

    invoke-virtual {p0, v0, p0}, Lcom/android/server/om/OverlayManagerService;->publishLocalService(Ljava/lang/Class;Ljava/lang/Object;)V

    return-void
.end method

.method synthetic lambda$-com_android_server_om_OverlayManagerService_39384()V
    .locals 5

    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mPersistSettingsScheduled:Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    sget-boolean v2, Lcom/android/server/om/OverlayManagerService;->DEBUG:Z

    if-eqz v2, :cond_0

    const-string/jumbo v2, "OverlayManager"

    const-string/jumbo v3, "Writing overlay settings"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_0
    iget-object v3, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v3

    const/4 v1, 0x0

    :try_start_0
    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    invoke-virtual {v2}, Landroid/util/AtomicFile;->startWrite()Ljava/io/FileOutputStream;

    move-result-object v1

    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mSettings:Lcom/android/server/om/OverlayManagerSettings;

    invoke-virtual {v2, v1}, Lcom/android/server/om/OverlayManagerSettings;->persist(Ljava/io/OutputStream;)V

    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    invoke-virtual {v2, v1}, Landroid/util/AtomicFile;->finishWrite(Ljava/io/FileOutputStream;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :goto_0
    monitor-exit v3

    return-void

    :catch_0
    move-exception v0

    :try_start_1
    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mSettingsFile:Landroid/util/AtomicFile;

    invoke-virtual {v2, v1}, Landroid/util/AtomicFile;->failWrite(Ljava/io/FileOutputStream;)V

    const-string/jumbo v2, "OverlayManager"

    const-string/jumbo v4, "failed to persist overlay state"

    invoke-static {v2, v4, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v2

    monitor-exit v3

    throw v2
.end method

.method public onBootPhase(I)V
    .locals 2

    const/16 v0, 0x1f4

    if-ne p1, v0, :cond_0

    iget-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mInitCompleteSignal:Ljava/util/concurrent/Future;

    const-string/jumbo v1, "Wait for OverlayManagerService init"

    invoke-static {v0, v1}, Lcom/android/internal/util/ConcurrentUtils;->waitForFutureNoInterrupt(Ljava/util/concurrent/Future;Ljava/lang/String;)Ljava/lang/Object;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/android/server/om/OverlayManagerService;->mInitCompleteSignal:Ljava/util/concurrent/Future;

    :cond_0
    return-void
.end method

.method public onStart()V
    .locals 0

    return-void
.end method

.method public onSwitchUser(I)V
    .locals 3

    iget-object v2, p0, Lcom/android/server/om/OverlayManagerService;->mLock:Ljava/lang/Object;

    monitor-enter v2

    :try_start_0
    iget-object v1, p0, Lcom/android/server/om/OverlayManagerService;->mImpl:Lcom/android/server/om/OverlayManagerServiceImpl;

    invoke-virtual {v1, p1}, Lcom/android/server/om/OverlayManagerServiceImpl;->updateOverlaysForUser(I)Ljava/util/ArrayList;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Lcom/android/server/om/OverlayManagerService;->updateAssets(ILjava/util/List;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v2

    invoke-direct {p0}, Lcom/android/server/om/OverlayManagerService;->schedulePersistSettings()V

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v2

    throw v1
.end method